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 --- .../onap/so/cloudify/utils/MsoCloudifyUtils.java | 26 +++++++++++----------- .../so/openstack/utils/MsoMulticloudUtils.java | 18 +++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'adapters/mso-adapter-utils/src') diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java index d7bc22aa7c..9042095e84 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -258,7 +258,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { // The workflow completed with errors. Must try to back it out. if (!backout) { logger.warn("{} Deployment installation failed, backout deletion suppressed {} {}", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue(), "Exception in Deployment Installation, backout suppressed"); } else { // Poll on delete if we rollback - use same values for now @@ -278,13 +278,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { // Didn't uninstall successfully. Log this error logger.error("{} Create Deployment: Cloudify error rolling back deployment install: {} {}", MessageEnum.RA_CREATE_STACK_ERR, installWorkflow.getError(), - ErrorCode.BusinessProcesssError.getValue()); + ErrorCode.BusinessProcessError.getValue()); } } catch (Exception e) { // Catch-all for backout errors trying to uninstall/delete // Log this error, and return the original exception logger.error("{} Create Stack: Nested exception rolling back deployment install: {}", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue(), e); } } @@ -299,7 +299,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { if (!backout) { logger.warn("{} Deployment installation failed, backout deletion suppressed {}", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue()); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue()); } else { // Poll on delete if we rollback - use same values for now int deletePollInterval = createPollInterval; @@ -318,7 +318,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { // Catch-all for backout errors trying to uninstall/delete // Log this error, and return the original exception logger.error("{} Create Stack: Nested exception rolling back deployment install: {} ", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), e); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue(), e); } } @@ -350,7 +350,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { } catch (CloudifyConnectException ce) { // Couldn't connect to Cloudify logger.error("{} QueryDeploymentOutputs: Cloudify connection failure: {} ", MessageEnum.RA_CREATE_STACK_ERR, - ErrorCode.BusinessProcesssError.getValue(), ce); + ErrorCode.BusinessProcessError.getValue(), ce); throw new MsoIOException(ce.getMessage(), ce); } catch (CloudifyResponseException re) { if (re.getStatus() == 404) { @@ -435,32 +435,32 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { // Workflow failed. Log it and return the execution object (don't throw exception here) logger.error("{} Cloudify workflow failure: {} {} Execute Workflow: Failed: {}", MessageEnum.RA_CREATE_STACK_ERR, execution.getError(), - ErrorCode.BusinessProcesssError.getValue(), execution.getError()); + ErrorCode.BusinessProcessError.getValue(), execution.getError()); return execution; } else if (status.equals(CANCELLED)) { // Workflow was cancelled, leaving the deployment in an indeterminate state. Log it and return the // execution object (don't throw exception here) logger.error("{} Cloudify workflow cancelled. Deployment is in an indeterminate state {} {} {}", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue(), "Execute Workflow cancelled: ", workflowId); return execution; } else { // Can only get here after a timeout logger.error("{} Cloudify workflow timeout {} Execute Workflow: Timed Out", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue()); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue()); } } catch (CloudifyConnectException ce) { logger.error("{} {} Execute Workflow ({} {}): Cloudify connection failure {} ", - MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcesssError.getValue(), command, ce); + MessageEnum.RA_CREATE_STACK_ERR, ErrorCode.BusinessProcessError.getValue(), command, ce); savedException = ce; } catch (CloudifyResponseException re) { logger.error("{} {} Execute Workflow ({}): Cloudify response error {} ", MessageEnum.RA_CREATE_STACK_ERR, - ErrorCode.BusinessProcesssError.getValue(), command, re.getMessage(), re); + ErrorCode.BusinessProcessError.getValue(), command, re.getMessage(), re); savedException = re; } catch (RuntimeException e) { // Catch-all logger.error("{} {} Execute Workflow ({}): Internal error {}", MessageEnum.RA_CREATE_STACK_ERR, - ErrorCode.BusinessProcesssError.getValue(), command, e.getMessage(), e); + ErrorCode.BusinessProcessError.getValue(), command, e.getMessage(), e); savedException = e; } @@ -578,7 +578,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin { } catch (CloudifyConnectException ce) { // Couldn't connect to Cloudify logger.error("{} QueryDeployment: Cloudify connection failure: {} ", MessageEnum.RA_CREATE_STACK_ERR, - ErrorCode.BusinessProcesssError.getValue(), ce); + ErrorCode.BusinessProcessError.getValue(), ce); throw new MsoIOException(ce.getMessage(), ce); } catch (CloudifyResponseException re) { if (re.getStatus() == 404) { diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index c648cc2137..ca0180ae4b 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -578,7 +578,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { if (!backout) { logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error, stack deletion suppressed", "", "", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Exception in Create Stack, stack deletion suppressed")); } else { try { @@ -621,7 +621,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e3, "", "", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Create Stack: Nested exception rolling back stack on error on query")); } } @@ -629,7 +629,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { // Just log this one. We will report the original exception. logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Create Stack: Nested exception rolling back stack")); } } @@ -644,13 +644,13 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack error: Polling complete with non-success status: " + stackInfo.getStatus() + ", " + stackInfo.getStatusMessage(), - "", "", ErrorCode.BusinessProcesssError.getValue(), "Create Stack error")); + "", "", ErrorCode.BusinessProcessError.getValue(), "Create Stack error")); // Rollback the stack creation, since it is in an indeterminate state. if (!backout) { logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion suppressed", "", "", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Create Stack error, stack deletion suppressed")); } else { try { @@ -685,7 +685,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, stack deletion FAILED", "", "", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Create Stack error, stack deletion FAILED")); logger.debug("Stack deletion FAILED on a rollback of a create - " + instanceId + ", status=" + queryInfo.getStatus() + ", reason=" @@ -699,7 +699,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { logger.warn(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", - ErrorCode.BusinessProcesssError.getValue(), me2.getContextMessage())); + ErrorCode.BusinessProcessError.getValue(), me2.getContextMessage())); } } StringBuilder errorContextMessage; @@ -717,7 +717,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { // shouldn't happen - but handle logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), "Create Stack: Nested exception rolling back stack: " + e2, "", "", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Exception in Create Stack: rolling back stack")); } } @@ -840,7 +840,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin { return JSON_MAPPER.readTree(directives); } catch (Exception e) { logger.error(String.format("%s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR.toString(), - "Create Stack: " + e, "", "", ErrorCode.BusinessProcesssError.getValue(), + "Create Stack: " + e, "", "", ErrorCode.BusinessProcessError.getValue(), "Exception in Create Stack: Invalid JSON format of directives" + directives)); MsoException me = new MsoAdapterException("Invalid JSON format of directives parameter: " + directives); me.addContext(CREATE_STACK); -- cgit 1.2.3-korg