diff options
author | 2020-10-01 17:47:19 -0400 | |
---|---|---|
committer | 2020-10-06 00:42:20 +0000 | |
commit | db8cae25abf7a3cb2ba5882109176affb9e65bc4 (patch) | |
tree | f16bebc475fdef4b98d8cf3db1a79a8405dc0c6d /ecomp-portal-BE-common | |
parent | fbbcfdc7e2a94407fa22394c3a89dc154ff9db17 (diff) |
Updated code for metrics logs
Issue-ID: PORTAL-1008
Signed-off-by: Kishore Reddy Dwaram <kishore.reddy.dwaram@att.com>
Change-Id: I10b4bbeba1c4bf119211d41886e52fa44a22ee4f
(cherry picked from commit 6a2eb370ce70dc5f2ee5a401e00b52071ddb0b8e)
Diffstat (limited to 'ecomp-portal-BE-common')
-rw-r--r-- | ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java | 26 |
1 files changed, 11 insertions, 15 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 b2ef2bc0..d45adee2 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 @@ -173,13 +173,12 @@ public class EPEELFLoggerAdvice { MDC.remove(Configuration.MDC_SERVER_FQDN); } 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(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)); + logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is started."); } - MDC.put("CustomField2", " InvocationID="+MDC.get(Configuration.MDC_KEY_REQUEST_ID)); - logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is started."); logger.debug(EELFLoggerDelegate.debugLogger, "EPEELFLoggerAdvice#before: entering {}", methodName); } catch (Exception e) { adviceLogger.error(EELFLoggerDelegate.errorLogger, "before failed", e); @@ -252,10 +251,9 @@ public class EPEELFLoggerAdvice { MDC.put(EPCommonSystemProperties.RESPONSE_CODE, externalAPIResponseCode); MDC.put(EPCommonSystemProperties.STATUS_CODE, "ERROR"); } - + MDC.put(SystemProperties.STATUS_CODE, "COMPLETE"); EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(className); - // Log security message, if necessary if (securityEventType != null) { MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, @@ -300,15 +298,13 @@ public class EPEELFLoggerAdvice { MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); MDC.remove(EPCommonSystemProperties.RESPONSE_CODE); - } else{ - MDC.put(SystemProperties.CUSTOM_FIELD1, "INVOKE-RETURN"); - } - - MDC.put(SystemProperties.STATUS_CODE, "COMPLETE"); + } else { + MDC.put(SystemProperties.CUSTOM_FIELD1, "INVOKE-RETURN"); MDC.put("CustomField2", " 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); - // add the metrics log - logger.info(EELFLoggerDelegate.metricsLogger, methodName + " operation is completed."); MDC.remove("CustomField1"); MDC.remove("CustomField2"); MDC.remove(className + methodName + EPCommonSystemProperties.METRICSLOG_BEGIN_TIMESTAMP); |