diff options
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java')
-rw-r--r-- | common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java index 0373abfe..e457f5f3 100644 --- a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java +++ b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-Logging * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import java.text.SimpleDateFormat; import java.time.Duration; import java.time.Instant; import java.util.Date; - import org.onap.policy.common.logging.nsa.LoggingContextFactory; import org.onap.policy.common.logging.nsa.SharedLoggingContext; import org.slf4j.MDC; @@ -144,7 +143,7 @@ public class OnapLoggingContext { * with key "TransactionElapsedTime". */ public void transactionEnded() { - Instant transactionEndTime = Instant.now(); + var transactionEndTime = Instant.now(); setTransactionEndTimestamp(transactionEndTime); setTransactionElapsedTime(transactionEndTime); } @@ -164,7 +163,7 @@ public class OnapLoggingContext { * "MetricElapsedTime". */ public void metricEnded() { - Instant metricEndTime = Instant.now(); + var metricEndTime = Instant.now(); setMetricEndTimestamp(metricEndTime); setMetricElapsedTime(metricEndTime); } @@ -450,7 +449,7 @@ public class OnapLoggingContext { * @param transactionStartTime transaction start time */ public void setTransactionBeginTimestamp(Instant transactionStartTime) { - SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); + var sdf = new SimpleDateFormat(TIME_FORMAT); context.put(TRANSACTION_BEGIN_TIME_STAMP, sdf.format(Date.from(transactionStartTime))); } @@ -469,7 +468,7 @@ public class OnapLoggingContext { * @param transactionEndTime transaction end time */ public void setTransactionEndTimestamp(Instant transactionEndTime) { - SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); + var sdf = new SimpleDateFormat(TIME_FORMAT); context.put(TRANSACTION_END_TIME_STAMP, sdf.format(Date.from(transactionEndTime))); } @@ -511,7 +510,7 @@ public class OnapLoggingContext { * @param metricStartTime metric start time */ public void setMetricBeginTimestamp(Instant metricStartTime) { - SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); + var sdf = new SimpleDateFormat(TIME_FORMAT); context.put(METRIC_BEGIN_TIME_STAMP, sdf.format(Date.from(metricStartTime))); } @@ -530,7 +529,7 @@ public class OnapLoggingContext { * @param metricEndTime metric end time */ public void setMetricEndTimestamp(Instant metricEndTime) { - SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); + var sdf = new SimpleDateFormat(TIME_FORMAT); context.put(METRIC_END_TIME_STAMP, sdf.format(Date.from(metricEndTime))); } |