fix: SiftingAppender 파일 락 해결 및 거래 로그 on/off 제어 추가
- DJErpApiAdapterController: MDC 제어를 TxSiftContext.begin/end로 교체 - TxSiftContext.end()를 별도 finally로 분리하여 항상 실행 보장 - elink-online-core: Logger SiftingAppender 개선 (submodule) - elink-online-common: TxSiftContext 추가 (submodule)
This commit is contained in:
+1
-1
Submodule elink-online-common updated: f3c2e64191...037fcd6302
+1
-1
Submodule elink-online-core updated: 8f7513865e...658f2a0485
@@ -1,7 +1,6 @@
|
||||
package com.eactive.eai.adapter.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -9,14 +8,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
// jwhong
|
||||
import org.json.simple.JSONObject;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -25,24 +20,20 @@ import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.adapter.AdapterPropManager;
|
||||
import com.eactive.eai.adapter.AdapterVO;
|
||||
import com.eactive.eai.adapter.http.HttpStatusException;
|
||||
import com.eactive.eai.adapter.http.client.HttpClientAdapterServiceKey;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpDynamicInAdapterManager;
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpDynamicInAdapterUri;
|
||||
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.JwtAuthException;
|
||||
import com.eactive.eai.adapter.service.DJErpApiAdapterService;
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.exception.ExceptionUtil;
|
||||
import com.eactive.eai.common.server.EAIServerManager;
|
||||
import com.eactive.eai.common.stdmessage.STDMessageManager;
|
||||
import com.eactive.eai.common.stdmessage.STDMsgInfoAddOnVO;
|
||||
import com.eactive.eai.common.util.DatetimeUtil;
|
||||
import com.eactive.eai.common.util.InboundErrorLogger;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
import com.eactive.eai.common.util.MessageUtil;
|
||||
import com.eactive.eai.common.util.TxFileLogger;
|
||||
import com.eactive.eai.common.util.TxSiftContext;
|
||||
import com.eactive.eai.common.util.UUIDGenerator;
|
||||
import com.eactive.eai.inbound.error.InboundErrorInfoVO;
|
||||
|
||||
@@ -116,7 +107,8 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
||||
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));
|
||||
|
||||
TxSiftContext.begin(uuid);
|
||||
|
||||
// jwhong, put api received time, eaiSvcCode
|
||||
transactionProp.put(INBOUND_REQUESTED_TIME, receivedTimeStr);
|
||||
@@ -171,12 +163,11 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
||||
*/
|
||||
try {
|
||||
TxFileLogger.logTxFile(transactionProp, responseData, "[IN_SEND]");
|
||||
MDC.remove(Logger.DISCRIMINATOR);
|
||||
|
||||
servletRequest.setAttribute(TransactionContextKeys.TRANSACTION_PROP, transactionProp);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.warn("http header db logging fail.", e);
|
||||
} finally {
|
||||
TxSiftContext.end();
|
||||
}
|
||||
}
|
||||
return responseEntity;
|
||||
@@ -260,21 +251,21 @@ public class DJErpApiAdapterController implements HttpAdapterServiceKey {
|
||||
InboundErrorLogger.error(errorInfoVO);
|
||||
}
|
||||
|
||||
private String makeResponseBodyMsg() {
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("result", 1);
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
map.put("code", "200");
|
||||
map.put("data", dataMap);
|
||||
map.put("message", "정상 처리 되었습니다.");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.putAll(map);
|
||||
|
||||
return json.toJSONString();
|
||||
}
|
||||
// private String makeResponseBodyMsg() {
|
||||
//
|
||||
// Map<String, Object> dataMap = new HashMap<>();
|
||||
// dataMap.put("result", 1);
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
//
|
||||
// map.put("code", "200");
|
||||
// map.put("data", dataMap);
|
||||
// map.put("message", "정상 처리 되었습니다.");
|
||||
//
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.putAll(map);
|
||||
//
|
||||
// return json.toJSONString();
|
||||
// }
|
||||
|
||||
/*
|
||||
* private String makeResponseBodyMsg(String asyncMsgStyle) {
|
||||
|
||||
Reference in New Issue
Block a user