diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-03-14 15:24:57 +0100 |
---|---|---|
committer | r.bogacki <r.bogacki@samsung.com> | 2019-03-18 11:02:58 +0100 |
commit | faa0b29e3b7b1fa23a1444a5d9ac020b3c60dedc (patch) | |
tree | 4839f982eb10e66e587b55b757ffc00dd5f9d30f /bpmn/mso-infrastructure-bpmn/src | |
parent | 4ca3abdffa40e7777a233151f66ee0b4131ed538 (diff) |
Removed MsoLogger class
Bye bye MsoLogger class.
Extracted constants to separated classes.
Fixed imports.
Change-Id: I7c8e0527e7dbd097d3ea93b9dab279354652da47
Issue-ID: LOG-631
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn/src')
7 files changed, 15 insertions, 36 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index 4ab22f4616..46a6fa3ef3 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -33,8 +33,8 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.Execution; import org.camunda.bpm.engine.runtime.MessageCorrelationResult; import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -221,7 +221,7 @@ public class CallbackHandlerService { + queryException; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException); + ErrorCode.UnknownError.getValue(), msg, queryException); } return false; @@ -264,7 +264,7 @@ public class CallbackHandlerService { + "': " + ole; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole); + ErrorCode.UnknownError.getValue(), msg, ole); //Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -297,14 +297,14 @@ public class CallbackHandlerService { String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; logger.debug(strMsg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, olex); + ErrorCode.UnknownError.getValue(), strMsg, olex); } catch (Exception excep) { retryCount = 0; //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; logger.debug(strMsg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep); + ErrorCode.UnknownError.getValue(), strMsg, excep); } } @@ -318,7 +318,7 @@ public class CallbackHandlerService { + "': " + e; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { // This must be an exception from the flow itself. Log it, but don't @@ -328,7 +328,7 @@ public class CallbackHandlerService { + "': " + e; logger.debug(msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -364,10 +364,10 @@ public class CallbackHandlerService { protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg); + ErrorCode.UnknownError.getValue(), msg); } else { logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); + ErrorCode.UnknownError.getValue(), msg, e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java index 267e24fec4..a74bdfc649 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java @@ -34,7 +34,6 @@ import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse; import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -65,8 +64,6 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im String correlationVariable = "SDNCA_requestId"; String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); - MsoLogger.setLogContext(correlationValue, "N/A"); - CallbackResult result = callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable, correlationValue, logMarker); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java index 65cc70d5f4..ed524c115e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java @@ -40,7 +40,6 @@ import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification; import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; import org.onap.so.bpmn.common.adapter.vnf.VnfRollback; import org.onap.so.bpmn.common.adapter.vnf.VnfStatus; -import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -118,8 +117,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFQ_messageId"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - QueryVnfNotification message = new QueryVnfNotification(); message.setMessageId(messageId); @@ -161,8 +158,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFC_messageId"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - CreateVnfNotification message = new CreateVnfNotification(); message.setMessageId(messageId); @@ -201,8 +196,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFU_messageId"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - UpdateVnfNotification message = new UpdateVnfNotification(); message.setMessageId(messageId); @@ -236,8 +229,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple String correlationVariable = "VNFDEL_uuid"; String correlationValue = messageId; - MsoLogger.setLogContext(correlationValue, "N/A"); - DeleteVnfNotification message = new DeleteVnfNotification(); message.setMessageId(messageId); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index a5af553e1c..075102331c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -36,8 +36,8 @@ import javax.ws.rs.core.Response; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError; import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -79,7 +79,6 @@ public class WorkflowMessageResource{ String message) { String method = "receiveWorkflowMessage"; - MsoLogger.setLogContext(correlator, "N/A"); logger.debug(LOGMARKER + " Received workflow message" + " type='" + messageType + "'" @@ -91,7 +90,7 @@ public class WorkflowMessageResource{ String msg = "Missing message type"; logger.debug(LOGMARKER + " " + msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); + ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -99,7 +98,7 @@ public class WorkflowMessageResource{ String msg = "Missing correlator"; logger.debug(LOGMARKER + " " + msg); logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", - MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); + ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index d10ecd1ce2..a5d479ae41 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -50,8 +50,8 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -202,7 +202,7 @@ public class WorkflowResource extends ProcessEngineAwareService { if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); @@ -237,10 +237,6 @@ public class WorkflowResource extends ProcessEngineAwareService { } private void setLogContext(String processKey, Map<String, Object> inputVariables) { - if (inputVariables != null) { - MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"), - getValueFromInputVariables(inputVariables, "mso-service-instance-id")); - } } private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) { @@ -591,7 +587,7 @@ public class WorkflowResource extends ProcessEngineAwareService { response.setProcessInstanceID(processInstanceId); logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError.getValue(), + ErrorCode.UnknownError.getValue(), LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response .getResponse()); logger.debug("Exception :",ex); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 04059557ae..f795bcc40e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -56,8 +56,6 @@ import org.camunda.bpm.model.bpmn.instance.StartEvent; import org.onap.so.bpmn.core.BPMNLogger; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -316,7 +314,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); - MsoLogger.setLogContext(requestId, svcid); } } catch(Exception e) { logger.error("Exception occurred", e); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java index 3dd2ac957c..2ba5c7286e 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java @@ -40,7 +40,6 @@ import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; |