From 927e0852b84d83e9d4b461c7ede8d2b4a60a4e2a Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Tue, 5 Mar 2024 18:22:59 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/base/syslog/ServiceCall.java | 3 ++- .../java/cokr/xit/base/syslog/service/bean/LogFilter.java | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/cokr/xit/base/syslog/ServiceCall.java b/src/main/java/cokr/xit/base/syslog/ServiceCall.java index 0cf811f..958499c 100644 --- a/src/main/java/cokr/xit/base/syslog/ServiceCall.java +++ b/src/main/java/cokr/xit/base/syslog/ServiceCall.java @@ -6,6 +6,7 @@ import java.util.List; import cokr.xit.foundation.Access; import cokr.xit.foundation.Assert; +import cokr.xit.foundation.LocalHost; import cokr.xit.foundation.UserInfo; /**서비스 요청 객체 @@ -22,7 +23,7 @@ public class ServiceCall { if (call == null) { cache.set(call = new ServiceCall()); call.userId = UserInfo.current().getId(); - call.ipAddress = Access.current().getIpAddress(); + call.ipAddress = Assert.ifEmpty(Access.current().getIpAddress(), LocalHost::getAddress); } return call; } diff --git a/src/main/java/cokr/xit/base/syslog/service/bean/LogFilter.java b/src/main/java/cokr/xit/base/syslog/service/bean/LogFilter.java index fdbc0bf..fefcf4e 100644 --- a/src/main/java/cokr/xit/base/syslog/service/bean/LogFilter.java +++ b/src/main/java/cokr/xit/base/syslog/service/bean/LogFilter.java @@ -11,6 +11,7 @@ import cokr.xit.base.file.web.DownloadView; import cokr.xit.base.file.web.XLSView; import cokr.xit.base.syslog.ServiceLog; import cokr.xit.foundation.AbstractComponent; +import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.data.DataObject; /**서비스 로그 필터. @@ -67,6 +68,11 @@ public class LogFilter extends AbstractComponent { case "onFailure": case "onLogout": log.setType(ServiceLog.LOG_INOUT); + UserInfo current = UserInfo.current(); + if (!current.isAuthenticated()) { + Object[] args = log.getArgs(); + log.setUserId(current.getId(args.length > 0 ? args[0] : null)); + } return true; default: return false; }