거래파일로그(SIFT_LOGGER) 출력기능 개발
- UUID별로 거래파일로그 생성
This commit is contained in:
@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
// jwhong
|
// jwhong
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
import org.slf4j.MDC;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -41,6 +42,7 @@ import com.eactive.eai.common.util.DatetimeUtil;
|
|||||||
import com.eactive.eai.common.util.InboundErrorLogger;
|
import com.eactive.eai.common.util.InboundErrorLogger;
|
||||||
import com.eactive.eai.common.util.Logger;
|
import com.eactive.eai.common.util.Logger;
|
||||||
import com.eactive.eai.common.util.MessageUtil;
|
import com.eactive.eai.common.util.MessageUtil;
|
||||||
|
import com.eactive.eai.common.util.TxFileLogger;
|
||||||
import com.eactive.eai.common.util.UUIDGenerator;
|
import com.eactive.eai.common.util.UUIDGenerator;
|
||||||
import com.eactive.eai.inbound.error.InboundErrorInfoVO;
|
import com.eactive.eai.inbound.error.InboundErrorInfoVO;
|
||||||
|
|
||||||
@@ -104,6 +106,9 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
String responseType = httpProp.getProperty(RESPONSE_TYPE, "SYNC");
|
String responseType = httpProp.getProperty(RESPONSE_TYPE, "SYNC");
|
||||||
ResponseEntity responseEntity = null;
|
ResponseEntity responseEntity = null;
|
||||||
Properties transactionProp = new Properties();
|
Properties transactionProp = new Properties();
|
||||||
|
String uuid = UUIDGenerator.getUUID().toString().replaceAll("-", "");
|
||||||
|
transactionProp.setProperty(TransactionContextKeys.TRANSACTION_UUID, uuid);
|
||||||
|
MDC.put(Logger.DISCRIMINATOR, transactionProp.getProperty(TransactionContextKeys.TRANSACTION_UUID));
|
||||||
// jwhong, put api received time, eaiSvcCode
|
// jwhong, put api received time, eaiSvcCode
|
||||||
transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeStr);
|
transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeStr);
|
||||||
|
|
||||||
@@ -141,8 +146,9 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
transactionProp.put(INBOUND_PATH_VARIABLES, pathVariables);
|
transactionProp.put(INBOUND_PATH_VARIABLES, pathVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String responseData = "";
|
||||||
try {
|
try {
|
||||||
String responseData = service.callApi(servletRequest, servletResponse, httpProp, adapterGroupVO, adapterVO,
|
responseData = service.callApi(servletRequest, servletResponse, httpProp, adapterGroupVO, adapterVO,
|
||||||
transactionProp);
|
transactionProp);
|
||||||
// if (RESPONSE_TYPE_ASYNC.equals(responseType)) { // table의 값이 ASYNC 로 들어가 있는데
|
// if (RESPONSE_TYPE_ASYNC.equals(responseType)) { // table의 값이 ASYNC 로 들어가 있는데
|
||||||
// response_type_async는 ASYN 로 되어 있어 아래처럼 비교함 jwhong 2025
|
// response_type_async는 ASYN 로 되어 있어 아래처럼 비교함 jwhong 2025
|
||||||
@@ -224,6 +230,7 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
filter.doPostFilter(adapterGroupName, postFilterNames, errorMsg, transactionProp, servletRequest, servletResponse);
|
filter.doPostFilter(adapterGroupName, postFilterNames, errorMsg, transactionProp, servletRequest, servletResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
responseData = errorMsg;
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
/**
|
/**
|
||||||
@@ -231,11 +238,13 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
|||||||
* 추후 더 좋은방법이 생길경우 개선 요망
|
* 추후 더 좋은방법이 생길경우 개선 요망
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
|
TxFileLogger.logTxFile(transactionProp, responseData, "[IN_SEND]");
|
||||||
servletRequest.setAttribute(TransactionContextKeys.TRANSACTION_PROP, transactionProp);
|
MDC.remove(Logger.DISCRIMINATOR);
|
||||||
|
|
||||||
|
servletRequest.setAttribute(TransactionContextKeys.TRANSACTION_PROP, transactionProp);
|
||||||
|
|
||||||
if (!"ASYNC".equals(responseType)) {
|
if (!"ASYNC".equals(responseType)) {
|
||||||
String uuid = transactionProp.getProperty(TransactionContextKeys.TRANSACTION_UUID);
|
// String uuid = transactionProp.getProperty(TransactionContextKeys.TRANSACTION_UUID);
|
||||||
String url = transactionProp.getProperty(HttpClientAdapterServiceKey.INBOUND_EXTURI);
|
String url = transactionProp.getProperty(HttpClientAdapterServiceKey.INBOUND_EXTURI);
|
||||||
String method = transactionProp.getProperty(HttpClientAdapterServiceKey.INBOUND_METHOD);
|
String method = transactionProp.getProperty(HttpClientAdapterServiceKey.INBOUND_METHOD);
|
||||||
int httpStatusCode = servletResponse.getStatus();
|
int httpStatusCode = servletResponse.getStatus();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.eactive.eai.common.exception.ExceptionUtil;
|
|||||||
import com.eactive.eai.common.message.MessageType;
|
import com.eactive.eai.common.message.MessageType;
|
||||||
import com.eactive.eai.common.util.CommonLib;
|
import com.eactive.eai.common.util.CommonLib;
|
||||||
import com.eactive.eai.common.util.Logger;
|
import com.eactive.eai.common.util.Logger;
|
||||||
|
import com.eactive.eai.common.util.TxFileLogger;
|
||||||
import com.eactive.eai.inbound.action.ActionFactory;
|
import com.eactive.eai.inbound.action.ActionFactory;
|
||||||
import com.eactive.eai.inbound.action.RequestAction;
|
import com.eactive.eai.inbound.action.RequestAction;
|
||||||
import com.eactive.eai.inbound.processor.Processor;
|
import com.eactive.eai.inbound.processor.Processor;
|
||||||
@@ -27,6 +28,7 @@ import org.apache.mina.common.ByteBuffer;
|
|||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.JSONValue;
|
import org.json.simple.JSONValue;
|
||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
|
import org.slf4j.MDC;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@@ -52,12 +54,14 @@ import java.io.IOException;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||||
import com.nimbusds.jwt.SignedJWT;
|
import com.nimbusds.jwt.SignedJWT;
|
||||||
|
import com.eactive.eai.common.TransactionContextKeys;
|
||||||
import com.eactive.eai.common.context.ElinkTransactionContext;
|
import com.eactive.eai.common.context.ElinkTransactionContext;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DJErpApiAdapterService extends HttpAdapterServiceSupport {
|
public class DJErpApiAdapterService extends HttpAdapterServiceSupport {
|
||||||
static Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER);
|
static Logger logger = Logger.getLogger(Logger.LOGGER_ADAPTER);
|
||||||
|
static Logger siftLogger = Logger.getLogger(Logger.LOGGER_SIFT);
|
||||||
|
|
||||||
public static final String HEADER_GROUP = "HEADER_GROUP";
|
public static final String HEADER_GROUP = "HEADER_GROUP";
|
||||||
public static final String HTTP_STATUS = "HTTP_STATUS"; // jwhong
|
public static final String HTTP_STATUS = "HTTP_STATUS"; // jwhong
|
||||||
@@ -284,6 +288,8 @@ public class DJErpApiAdapterService extends HttpAdapterServiceSupport {
|
|||||||
} else {
|
} else {
|
||||||
message = paramValue;
|
message = paramValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TxFileLogger.logTxFile(transactionProp, message, "[IN_RECV]");
|
||||||
|
|
||||||
if (logger.isDebug()) {
|
if (logger.isDebug()) {
|
||||||
String[] msgArgs = new String[2];
|
String[] msgArgs = new String[2];
|
||||||
@@ -367,6 +373,7 @@ public class DJErpApiAdapterService extends HttpAdapterServiceSupport {
|
|||||||
// if ( encryptResponseApply) {
|
// if ( encryptResponseApply) {
|
||||||
// result = doPostEncryption(result, transactionProp, request); // jwhong Encrypt
|
// result = doPostEncryption(result, transactionProp, request); // jwhong Encrypt
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user