summaryrefslogtreecommitdiffstats
path: root/aai-resources
diff options
context:
space:
mode:
authorpranavdi <Pranav.Dixit@amdocs.com>2017-09-22 23:26:32 +0530
committerpranavdi <Pranav.Dixit@amdocs.com>2017-09-22 23:26:32 +0530
commit62347fb521a81fca84c031a1c5bc9a60837eeada (patch)
tree2dca85c31c512c0f20ebd4a70b240c55af899c50 /aai-resources
parent30402974352f2b3cbb6a824e6306560a94c28007 (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: I4a4db91fa45ced7b30d346b884e4d4841391f64b Issue-Id: AAI-274 Signed-off-by: pranavdi <Pranav.Dixit@amdocs.com>
Diffstat (limited to 'aai-resources')
-rw-r--r--aai-resources/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/aai-resources/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java b/aai-resources/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java
index 050283d..b1177f6 100644
--- a/aai-resources/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java
+++ b/aai-resources/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,21 @@ 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);