HTTP Header 로그 off 기능 - -Duse.http.header.log=y 옵션 추가시 로깅
This commit is contained in:
+13
-1
@@ -53,6 +53,8 @@ public abstract class HttpClient5AdapterServiceSupport implements HttpClientAdap
|
||||
|
||||
private static boolean testMode = TestModeChecker.isTestMode();
|
||||
|
||||
private static boolean httpHeaderLogMode = HttpAdapterExtraLogUtil.isHttpHeaderMode();
|
||||
|
||||
public synchronized void close() {
|
||||
if(connectionManager != null) {
|
||||
connectionManager.close();
|
||||
@@ -396,6 +398,11 @@ public abstract class HttpClient5AdapterServiceSupport implements HttpClientAdap
|
||||
|
||||
|
||||
HttpRequestInterceptor requestLogInterceptor = (request, entity, context) -> {
|
||||
if (!httpHeaderLogMode) {
|
||||
logger.info("httpHeader logging off - use.http.header.log");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String uuid = (String) context.getAttribute(TransactionContextKeys.TRANSACTION_UUID);
|
||||
String contextAdapterGroupName = (String) context.getAttribute(HttpClientAdapterServiceKey.ADAPTER_GROUP_NAME);
|
||||
@@ -415,7 +422,12 @@ public abstract class HttpClient5AdapterServiceSupport implements HttpClientAdap
|
||||
};
|
||||
|
||||
HttpResponseInterceptor responseLogInterceptor = (response, entity, context) -> {
|
||||
try{
|
||||
if (!httpHeaderLogMode) {
|
||||
logger.info("httpHeader logging off - use.http.header.log");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
HttpRequest request = (HttpRequest)context.getAttribute("http.request");
|
||||
String url = request.getUri().toString();
|
||||
String uuid = (String) context.getAttribute(TransactionContextKeys.TRANSACTION_UUID);
|
||||
|
||||
@@ -21,6 +21,10 @@ import org.apache.commons.lang3.StringUtils;
|
||||
public class HttpAdapterExtraLogUtil {
|
||||
|
||||
static Logger logger = Logger.getLogger(Logger.LOGGER_DEFAULT);
|
||||
|
||||
public static boolean isHttpHeaderMode() {
|
||||
return StringUtils.equals(System.getProperty("use.http.header.log", "n"), "y");
|
||||
}
|
||||
|
||||
public static void insertHttpAdapterExtraLog(String guid, int serviceProcessNumber, String adapterGroupName, String adapterName, Map<Object, Object> headers, String url, String httpMethod){
|
||||
insertHttpAdapterExtraLog(guid, serviceProcessNumber, adapterGroupName, adapterName, headers, url, httpMethod, 0);
|
||||
|
||||
@@ -4,6 +4,9 @@ import java.util.Calendar;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.context.ElinkTransactionContext;
|
||||
import com.eactive.eai.common.util.*;
|
||||
@@ -96,7 +99,9 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
//isPEAIServer = eaiServerManager.isPEAIServer();
|
||||
instid = eaiServerManager.getGroupInstId();
|
||||
}
|
||||
|
||||
|
||||
private static boolean httpHeaderLogMode = HttpAdapterExtraLogUtil.isHttpHeaderMode();
|
||||
|
||||
private ProcessVO setVO(Properties prop,long msgRcvTm) throws RequestProcessorException{
|
||||
String actionName = prop.getProperty(Processor.REQUEST_ACTION);
|
||||
String adapterGroupName = prop.getProperty(Processor.ADAPTER_GROUP_NAME);
|
||||
@@ -422,12 +427,16 @@ public class RequestProcessor extends RequestProcessorSupport {
|
||||
|
||||
// INBOUND_HEADER 가 NULL인 경우는 HTTP가 아닌것으로 간주함.
|
||||
if(prop.get(HttpClientAdapterServiceKey.INBOUND_HEADER) != null) {
|
||||
HttpAdapterExtraLogUtil.insertHttpAdapterExtraLog(vo.getUuid(), 100,
|
||||
prop.getProperty(HttpClientAdapterServiceKey.ADAPTER_GROUP_NAME),
|
||||
prop.getProperty(HttpClientAdapterServiceKey.ADAPTER_NAME),
|
||||
(Properties) prop.get(HttpClientAdapterServiceKey.INBOUND_HEADER),
|
||||
prop.getProperty(HttpClientAdapterServiceKey.INBOUND_EXTURI)+"?"+prop.getProperty(HttpClientAdapterServiceKey.INBOUND_EXTPARAMS),
|
||||
prop.getProperty(HttpClientAdapterServiceKey.INBOUND_METHOD));
|
||||
if (!httpHeaderLogMode) {
|
||||
logger.info("httpHeader logging off - use.http.header.log");
|
||||
} else {
|
||||
HttpAdapterExtraLogUtil.insertHttpAdapterExtraLog(vo.getUuid(), 100,
|
||||
prop.getProperty(HttpClientAdapterServiceKey.ADAPTER_GROUP_NAME),
|
||||
prop.getProperty(HttpClientAdapterServiceKey.ADAPTER_NAME),
|
||||
(Properties) prop.get(HttpClientAdapterServiceKey.INBOUND_HEADER),
|
||||
prop.getProperty(HttpClientAdapterServiceKey.INBOUND_EXTURI)+"?"+prop.getProperty(HttpClientAdapterServiceKey.INBOUND_EXTPARAMS),
|
||||
prop.getProperty(HttpClientAdapterServiceKey.INBOUND_METHOD));
|
||||
}
|
||||
}
|
||||
|
||||
EAIMessage eaiMsg = null;
|
||||
|
||||
Reference in New Issue
Block a user