From 75ea836990332d1d8797e0e2ec10820d628c95b3 Mon Sep 17 00:00:00 2001 From: pranavdi Date: Sun, 17 Sep 2017 12:27:07 +0530 Subject: Add RequestId and PartnerName in log The Onap application logging guidelines suggest the logs should have MDCs for RequestId and PartnerName to create audit trail. Adding the same for AAI logs Change-Id: Idfc6c4c0d31eaec90c8c397ee526072a09e1504e Issue-ID: AAI-274 Signed-off-by: pranavdi --- .../aai/interceptors/AAILogJAXRSInInterceptor.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'aai-traversal/src/main/java') diff --git a/aai-traversal/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java b/aai-traversal/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java index a0ddeff..958639f 100644 --- a/aai-traversal/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java +++ b/aai-traversal/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java @@ -46,6 +46,7 @@ import org.openecomp.aai.util.HbaseSaltPrefixer; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import org.slf4j.MDC; public class AAILogJAXRSInInterceptor extends JAXRSInInterceptor { @@ -216,8 +217,22 @@ public class AAILogJAXRSInInterceptor extends JAXRSInInterceptor { } else if (replacedTransId) { logMsg = "Replaced invalid requestID of " + transId + " Assigned " + newTransId; } - } - + MDC.put("RequestId",newTransId); + } + else { + MDC.put("RequestId",transId); + } + + + List fromAppIdList = headersList.get("X-FromAppId"); + if (fromAppIdList != null) { + String fromAppId = null; + for (String fromAppIdValue : fromAppIdList) { + fromAppId = fromAppIdValue; + } + MDC.put("PartnerName",fromAppId); + } + List contentType = headersList.get("Content-Type"); if (contentType == null) { ct = (String)message.get(Message.CONTENT_TYPE); -- cgit 1.2.3-korg