diff options
author | Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com> | 2018-03-14 16:51:48 -0400 |
---|---|---|
committer | Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com> | 2018-03-15 10:18:35 -0400 |
commit | 394a6d343c0b7b5b887221de66e176f83f334d4a (patch) | |
tree | 780cd4d2c79e6508b3b72fccbc7f6c805f517c7b /ecomp-sdk/epsdk-core | |
parent | 59465af26eaec33902d9de7b3b57c7744eb02435 (diff) |
Added Junits
Issue-ID: PORTAL-136
Includes JUNITS
Change-Id: I84b5281bae05210faf7db999335f1fdcf3094fc0
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core')
-rw-r--r-- | ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java index 779a24fc..fc7c407f 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java @@ -154,10 +154,14 @@ public class EELFLoggerAdvice { if (MDC.get(SystemProperties.TARGET_ENTITY) == null || MDC.get(SystemProperties.TARGET_ENTITY) == "") { MDC.put(SystemProperties.TARGET_ENTITY, appName + "_BE"); } + + MDC.put(SystemProperties.STATUS_CODE, result); + MDC.put(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP, MDC.get(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP)); MDC.put(SystemProperties.METRICSLOG_END_TIMESTAMP, getCurrentDateTimeUTC()); + this.calculateDateTimeDifference(MDC.get(SystemProperties.METRICSLOG_BEGIN_TIMESTAMP), MDC.get(SystemProperties.METRICSLOG_END_TIMESTAMP)); @@ -186,6 +190,8 @@ public class EELFLoggerAdvice { MDC.remove(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP); MDC.remove(SystemProperties.AUDITLOG_BEGIN_TIMESTAMP); MDC.remove(SystemProperties.AUDITLOG_END_TIMESTAMP); + }else{ + MDC.put(SystemProperties.STATUS_CODE, "COMPLETE"); } MDC.remove(className + methodName + SystemProperties.METRICSLOG_BEGIN_TIMESTAMP); @@ -194,6 +200,8 @@ public class EELFLoggerAdvice { MDC.remove(SystemProperties.MDC_TIMER); MDC.remove(SystemProperties.TARGET_ENTITY); MDC.remove(SystemProperties.TARGET_SERVICE_NAME); + MDC.remove(SystemProperties.STATUS_CODE); + } catch (Exception e) { adviceLogger.error(EELFLoggerDelegate.errorLogger, "after failed", e); } @@ -236,7 +244,7 @@ public class EELFLoggerAdvice { try { Date beginDate = ecompLogDateFormat.parse(beginDateTime); Date endDate = ecompLogDateFormat.parse(endDateTime); - String timeDifference = String.format("%d ms", endDate.getTime() - beginDate.getTime()); + String timeDifference = String.format("%d", endDate.getTime() - beginDate.getTime()); MDC.put(SystemProperties.MDC_TIMER, timeDifference); } catch (Exception e) { adviceLogger.error(EELFLoggerDelegate.errorLogger, "calculateDateTimeDifference failed", e); |