diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2017-09-04 05:45:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-04 05:45:45 +0000 |
commit | d0860c92b307d6af622b2357103831eba9a5ddac (patch) | |
tree | d0f91b5703828c32376982bc619baa030d49cc02 /common | |
parent | 5239a65cc2efdd2cd6fd4db6f8466a3c4d769f51 (diff) | |
parent | 7868ed0487009cc7285a35d1bcd76f7cba6b9bdd (diff) |
Merge "Fix to get calling application identifier"
Diffstat (limited to 'common')
-rw-r--r-- | common/src/main/java/org/openecomp/mso/logger/LogFilter.java | 5 | ||||
-rw-r--r-- | common/src/main/java/org/openecomp/mso/logger/MsoLogger.java | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java b/common/src/main/java/org/openecomp/mso/logger/LogFilter.java index ca25ad2e22..6eaf356c0e 100644 --- a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java +++ b/common/src/main/java/org/openecomp/mso/logger/LogFilter.java @@ -53,6 +53,11 @@ public class LogFilter implements Filter { if (null != userPrincipal) { MDC.put (MsoLogger.PARTNERNAME, userPrincipal.getName ()); } + //Set identity of calling application / component + String fromAppId = httpRequest.getHeader(MsoLogger.HEADER_FROM_APP_ID); + if(fromAppId != null && !fromAppId.isEmpty()) { + MDC.put (MsoLogger.FROM_APP_ID, fromAppId); + } chain.doFilter(httpRequest, httpResponse); } diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java index 4c39815bd0..e9b6fb1225 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java +++ b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java @@ -71,6 +71,9 @@ public class MsoLogger { private static final String USER = "User"; private static final String DUMMY_VALUE = "trace-#"; public static final String UNKNOWN = "UNKNOWN"; + //For getting an identity of calling application + public static final String HEADER_FROM_APP_ID = "X-FromAppId"; + public static final String FROM_APP_ID = "FromAppId"; // Audit/Metric log specific private static final String BEGINTIME = "BeginTimestamp"; private static final String ENDTIME = "EndTimestamp"; |