거래파일로그 기능 추가
- HTTP Inbound 거래도 출력되도록 수정 - HTTP Header 파일로그 추가
This commit is contained in:
@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
@@ -16,7 +17,9 @@ import com.eactive.eai.adapter.http.dynamic.filter.HttpAdapterFilter;
|
||||
import com.eactive.eai.adapter.http.dynamic.filter.HttpAdapterFilterFactory;
|
||||
import com.eactive.eai.adapter.http.dynamic.filter.HttpAdapterFilterType;
|
||||
import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException;
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.common.util.UUIDGenerator;
|
||||
|
||||
public abstract class HttpAdapterServiceSupport implements HttpAdapterService, HttpAdapterServiceKey {
|
||||
private static final String LOG_PREFIX = "HttpAdapterServiceSupport] ";
|
||||
@@ -27,7 +30,19 @@ public abstract class HttpAdapterServiceSupport implements HttpAdapterService, H
|
||||
|
||||
public Object service(String adptGrpName, String adptName, Object message, Properties prop,
|
||||
HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String uuid = prop.getProperty(TransactionContextKeys.TRANSACTION_UUID);
|
||||
boolean bMDCput = false;
|
||||
if(uuid == null) {
|
||||
uuid = UUIDGenerator.getUUID().toString().replaceAll("-", "");
|
||||
prop.setProperty(TransactionContextKeys.TRANSACTION_UUID, uuid);
|
||||
}
|
||||
|
||||
if(MDC.get(Logger.DISCRIMINATOR) == null) {
|
||||
MDC.put(Logger.DISCRIMINATOR, uuid);
|
||||
bMDCput = true;
|
||||
}
|
||||
|
||||
try {
|
||||
String transactionId = request.getHeader(HttpClientAdapterServiceKey.TRANSACTION_ID);
|
||||
if (StringUtils.isNotBlank(transactionId)) {
|
||||
prop.put(HttpClientAdapterServiceKey.TRANSACTION_ID, transactionId);
|
||||
@@ -44,6 +59,7 @@ public abstract class HttpAdapterServiceSupport implements HttpAdapterService, H
|
||||
prop.put(HttpClientAdapterServiceKey.INSTANCE_ID, instanceId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn(LOG_PREFIX + "Failed to read request headers: " + e.getMessage());
|
||||
}
|
||||
|
||||
Object obj = null;
|
||||
@@ -75,6 +91,10 @@ public abstract class HttpAdapterServiceSupport implements HttpAdapterService, H
|
||||
} else {
|
||||
throw new Exception("RECEAIAHA001");
|
||||
}
|
||||
} finally {
|
||||
if(bMDCput)
|
||||
MDC.remove(Logger.DISCRIMINATOR);
|
||||
}
|
||||
}
|
||||
|
||||
private Object doPreFilters(String adptGrpName, String adptName, Object message, Properties prop,
|
||||
|
||||
@@ -72,6 +72,9 @@ public class HttpAdapterExtraLogUtil {
|
||||
}
|
||||
httpAdapterExtraLogVo.setHeaderList(headerVoList);
|
||||
httpAdapterExtraLogVo.setHttpStatus(httpStatus);
|
||||
|
||||
logger.debug("[{}] Insert HTTP Log. - {}", guid, httpAdapterExtraLogVo);
|
||||
|
||||
if(ElinkConfig.isUseAsyncLogging()) {
|
||||
AsyncHttpLoggingPoolManager.getInstance().publish(httpAdapterExtraLogVo);
|
||||
} else {
|
||||
|
||||
@@ -4,9 +4,8 @@ import java.util.Properties;
|
||||
|
||||
public class TxFileLogger {
|
||||
|
||||
private static Logger siftLogger = Logger.getLogger(Logger.LOGGER_SIFT);
|
||||
|
||||
public static void logTxFile(Properties transactionProp, String message, String prefix) {
|
||||
Logger siftLogger = Logger.getLogger(Logger.LOGGER_SIFT);
|
||||
if (siftLogger.isInfoEnabled()) {
|
||||
siftLogger.info(prefix + message);
|
||||
if (siftLogger.isDebugEnabled())
|
||||
|
||||
Reference in New Issue
Block a user