diff options
author | pranavdi <Pranav.Dixit@amdocs.com> | 2017-09-17 12:27:07 +0530 |
---|---|---|
committer | pranavdi <Pranav.Dixit@amdocs.com> | 2017-09-18 13:49:24 +0530 |
commit | 75ea836990332d1d8797e0e2ec10820d628c95b3 (patch) | |
tree | 699cc1aa632cd83eaf5d89a5ef57af61465636b2 /aai-traversal/src/main | |
parent | 4bf37be558f9412b5e67b1913a1319ade297778f (diff) |
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 <Pranav.Dixit@amdocs.com>
Diffstat (limited to 'aai-traversal/src/main')
-rw-r--r-- | aai-traversal/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java | 19 |
1 files changed, 17 insertions, 2 deletions
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<String> fromAppIdList = headersList.get("X-FromAppId"); + if (fromAppIdList != null) { + String fromAppId = null; + for (String fromAppIdValue : fromAppIdList) { + fromAppId = fromAppIdValue; + } + MDC.put("PartnerName",fromAppId); + } + List<String> contentType = headersList.get("Content-Type"); if (contentType == null) { ct = (String)message.get(Message.CONTENT_TYPE); |