summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishore Reddy Dwaram <kishore.reddy.dwaram@att.com>2020-10-02 16:58:46 -0400
committerKishore Reddy Dwaram <kishore.reddy.dwaram@att.com>2020-10-06 13:34:26 +0000
commit10d101e44b4164744d381946893cd71a78353631 (patch)
tree8bca7372adf4045bb10b5b40ecbede6a1dbd38af
parentdb8cae25abf7a3cb2ba5882109176affb9e65bc4 (diff)
Updated code for audit logs3.4.13.4.0
Issue-ID: PORTAL-1008 Signed-off-by: Kishore Reddy Dwaram <kishore.reddy.dwaram@att.com> Change-Id: I31319a5e528b81306534bca6ff89050c40580034 (cherry picked from commit 7ee79c657d68a412e36363aa782881f0edb10115)
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java
index d45adee2..43ea4c3f 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java
@@ -129,7 +129,7 @@ public class EPEELFLoggerAdvice {
MDC.put(EPCommonSystemProperties.PARTNER_NAME, "Unknown");
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className);
- MDC.put(SystemProperties.STATUS_CODE, "INPROGRESS");
+ MDC.put(EPCommonSystemProperties.STATUS_CODE, "INPROGRESS");
// Log security message, if necessary
if (securityEventType != null) {
@@ -138,8 +138,6 @@ public class EPEELFLoggerAdvice {
MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,getCurrentDateTimeUTC());
MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, getCurrentDateTimeUTC());
this.calculateDateTimeDifference(MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
- MDC.put("CustomField1", "ENTRY");
- MDC.put("CustomField2", "InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
HttpServletRequest req = null;
if (args.length > 0 && args[0] != null && args[0] instanceof HttpServletRequest) {
req = (HttpServletRequest) args[0];
@@ -151,6 +149,8 @@ public class EPEELFLoggerAdvice {
adviceLogger.error(EELFLoggerDelegate.errorLogger,
" while setting the IP address ", e);
}
+ MDC.put(SystemProperties.CUSTOM_FIELD1, "ENTRY");
+ MDC.put(SystemProperties.CUSTOM_FIELD2, "InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
this.logSecurityMessage(logger, securityEventType, methodName);
// Outgoing & LDAP messages are part of Incoming requests so,
@@ -175,8 +175,8 @@ public class EPEELFLoggerAdvice {
} else {
MDC.put(SystemProperties.METRICSLOG_END_TIMESTAMP, getCurrentDateTimeUTC());
this.calculateDateTimeDifference(MDC.get(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP),MDC.get(SystemProperties.METRICSLOG_END_TIMESTAMP));
- MDC.put("CustomField1", "INVOKE");
- MDC.put("CustomField2", " InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
+ MDC.put(SystemProperties.CUSTOM_FIELD1, "INVOKE");
+ MDC.put(SystemProperties.CUSTOM_FIELD2, " InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is started.");
}
logger.debug(EELFLoggerDelegate.debugLogger, "EPEELFLoggerAdvice#before: entering {}", methodName);
@@ -251,7 +251,7 @@ public class EPEELFLoggerAdvice {
MDC.put(EPCommonSystemProperties.RESPONSE_CODE, externalAPIResponseCode);
MDC.put(EPCommonSystemProperties.STATUS_CODE, "ERROR");
}
- MDC.put(SystemProperties.STATUS_CODE, "COMPLETE");
+ MDC.put(EPCommonSystemProperties.STATUS_CODE, "COMPLETE");
EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className);
// Log security message, if necessary
@@ -261,8 +261,8 @@ public class EPEELFLoggerAdvice {
MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, getCurrentDateTimeUTC());
this.calculateDateTimeDifference(MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),
MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
- MDC.put("CustomField1", "EXIT");
- MDC.put("CustomField2", "InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
+ MDC.put(SystemProperties.CUSTOM_FIELD1, "EXIT");
+ MDC.put(SystemProperties.CUSTOM_FIELD2, "InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
try {
MDC.put(Configuration.MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName());
} catch (Exception e) {
@@ -300,13 +300,13 @@ public class EPEELFLoggerAdvice {
} else {
MDC.put(SystemProperties.CUSTOM_FIELD1, "INVOKE-RETURN");
- MDC.put("CustomField2", " InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
+ MDC.put(SystemProperties.CUSTOM_FIELD2, " InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID));
// add the metrics log
logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is completed.");
}
logger.debug(EELFLoggerDelegate.debugLogger, "EPEELFLoggerAdvice#after: finished {}", methodName);
- MDC.remove("CustomField1");
- MDC.remove("CustomField2");
+ MDC.remove(SystemProperties.CUSTOM_FIELD1);
+ MDC.remove(SystemProperties.CUSTOM_FIELD2);
MDC.remove(className + methodName + EPCommonSystemProperties.METRICSLOG_BEGIN_TIMESTAMP);
MDC.remove(EPCommonSystemProperties.METRICSLOG_BEGIN_TIMESTAMP);
MDC.remove(EPCommonSystemProperties.METRICSLOG_END_TIMESTAMP);