From 79abe5d8bfd3c6180ec183d82077f7177e6cd494 Mon Sep 17 00:00:00 2001 From: "Plummer, Brittany" Date: Fri, 22 Nov 2019 08:20:45 -0500 Subject: improve error log scores Updated error code name to fix spelling Defaulted errorcode and errordesc to unknown when not provided Remove unused imports from nc orchestrator application Added defaulting of serviceName to error log Issue-ID: SO-2538 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I5ae960f728739e2528173b66484562742429416c --- common/src/main/java/org/onap/so/logger/ErrorCode.java | 2 +- common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java | 2 +- common/src/main/java/org/onap/so/utils/CryptoUtils.java | 4 ++-- .../src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java index 7fb9522b7c..a57ed99f2b 100644 --- a/common/src/main/java/org/onap/so/logger/ErrorCode.java +++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java @@ -25,7 +25,7 @@ public enum ErrorCode { AvailabilityError(200), DataError(300), SchemaError(400), - BusinessProcesssError(500), + BusinessProcessError(500), UnknownError(900); private int value; diff --git a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java b/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java index 6a20932666..41c4b4bfae 100644 --- a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java +++ b/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java @@ -50,7 +50,7 @@ public class ScheduledTasksMDCSetup extends MDCSetup { } public void errorMDCSetup(ErrorCode errorCode, String errorDescription) { - MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, errorCode.toString()); + MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, String.valueOf(errorCode.getValue())); MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, errorDescription); } diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java index 640660e97c..ff69e3e4b1 100644 --- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java +++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java @@ -91,7 +91,7 @@ public final class CryptoUtils { return CryptoUtils.encrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), - ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in encryptPassword ", e); return null; } } @@ -101,7 +101,7 @@ public final class CryptoUtils { return CryptoUtils.decrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(), - ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in encryptPassword ", e); return null; } } diff --git a/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java b/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java index 8db611b6b1..f232781871 100644 --- a/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java +++ b/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java @@ -60,7 +60,7 @@ public class ScheduledTasksMDCSetupTest { public void errorMDCSetupTest() { tasksMDCSetup.errorMDCSetup(ErrorCode.UnknownError, "Error"); - assertEquals(ErrorCode.UnknownError.toString(), MDC.get(ONAPLogConstants.MDCs.ERROR_CODE)); + assertEquals("900", MDC.get(ONAPLogConstants.MDCs.ERROR_CODE)); assertEquals("Error", MDC.get(ONAPLogConstants.MDCs.ERROR_DESC)); } -- cgit 1.2.3-korg