summaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-03-04 14:43:15 +0100
committerr.bogacki <r.bogacki@samsung.com>2019-03-04 14:43:51 +0100
commitdd4a24f5f1430529d17c337172cdfa1cade21055 (patch)
tree4bddec5c3d82b5576bfe54397f6261fd26bb7db2 /bpmn/mso-infrastructure-bpmn/src/main/java/org/onap
parent0f4371f47e72c413b2a28d3a0426bdac49f1291b (diff)
Removed MsoLogger from 'mso-infrastructure-bpmn'
Replaced MsoLogger with plain slf4j. Refactored login output. Fixed imports. Change-Id: I05fa4d03fe2688a888c592a9c19c90e4fc213e48 Issue-ID: LOG-631 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn/src/main/java/org/onap')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java77
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java22
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java17
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java110
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java9
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java19
8 files changed, 118 insertions, 150 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 02164ccec1..920cb11e4c 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,6 +35,8 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
import org.onap.so.bpmn.core.UrnPropertiesReader;
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;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -47,7 +51,7 @@ public class CallbackHandlerService {
public static final long FAST_POLL_INT_MS = 100;
public static final long SLOW_POLL_INT_MS = 1000;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CallbackHandlerService.class);
+ private static final Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class);
@Autowired
RuntimeService runtimeService;
@@ -75,7 +79,7 @@ public class CallbackHandlerService {
long startTime = System.currentTimeMillis();
- LOGGER.debug(logMarker + " " + method + " received message: "
+ logger.debug(logMarker + " " + method + " received message: "
+ (message == null ? "" : System.lineSeparator()) + message);
try {
@@ -101,7 +105,7 @@ public class CallbackHandlerService {
logCallbackSuccess(method, startTime);
return new CallbackSuccess();
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
String msg = "Caught " + e.getClass().getSimpleName()
+ " processing " + messageEventName + " with " + correlationVariable
+ " = '" + correlationValue + "'";
@@ -133,7 +137,7 @@ public class CallbackHandlerService {
protected boolean correlate(String messageEventName, String correlationVariable,
String correlationValue, Map<String, Object> variables, String logMarker) {
try{
- LOGGER.debug(logMarker + " Attempting to find process waiting"
+ logger.debug(logMarker + " Attempting to find process waiting"
+ " for " + messageEventName + " with " + correlationVariable
+ " = '" + correlationValue + "'");
@@ -200,7 +204,7 @@ public class CallbackHandlerService {
execInfoList.add(new ExecInfo(execution));
}
- LOGGER.debug(logMarker + " Found " + count + " process(es) waiting"
+ logger.debug(logMarker + " Found " + count + " process(es) waiting"
+ " for " + messageEventName + " with " + correlationVariable
+ " = '" + correlationValue + "': " + execInfoList);
@@ -211,9 +215,9 @@ public class CallbackHandlerService {
+ messageEventName + " with " + correlationVariable
+ " = '" + correlationValue + "'; last exception was:"
+ queryException;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, queryException);
+ logger.debug(msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException);
}
return false;
@@ -234,7 +238,7 @@ public class CallbackHandlerService {
// acknowledged the notification associated with request #1.
try {
- LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
+ logger.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
+ messageEventName + " with " + correlationVariable + " = '"
+ correlationValue + "'");
@@ -254,9 +258,9 @@ public class CallbackHandlerService {
String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + ole;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, ole);
+ logger.debug(msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole);
//Retry for OptimisticLocking Exceptions
int retryCount = 0;
@@ -269,7 +273,7 @@ public class CallbackHandlerService {
}
}
- LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount);
+ logger.debug("Retry correlate for OptimisticLockingException, retryCount:{}", retryCount);
for (; retryCount >0 ; retryCount--) {
@@ -283,20 +287,20 @@ public class CallbackHandlerService {
.processInstanceVariableEquals(correlationVariable, correlationValue)
.correlateWithResult();
retryCount = 0;
- LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount);
+ logger.debug("OptimisticLockingException retry was successful, seting retryCount: {}", retryCount);
} catch (OptimisticLockingException olex) {
//oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, olex);
+ logger.debug(strMsg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.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, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, excep);
+ logger.debug(strMsg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep);
}
}
@@ -308,9 +312,9 @@ public class CallbackHandlerService {
+ execInfoList.get(0) + " after receiving " + messageEventName
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
+ logger.debug(msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
} catch (Exception e) {
// This must be an exception from the flow itself. Log it, but don't
@@ -318,9 +322,9 @@ public class CallbackHandlerService {
String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
+ logger.debug(msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
return true;
@@ -332,12 +336,6 @@ public class CallbackHandlerService {
* @param startTime the request start time
*/
protected void logCallbackSuccess(String method, long startTime) {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
}
/**
@@ -361,19 +359,12 @@ public class CallbackHandlerService {
*/
protected void logCallbackError(String method, long startTime, String msg, Exception e) {
if (e == null) {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg);
} else {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
-
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
}
/**
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
index 014b06deff..f9f06447a7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -39,8 +41,9 @@ import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
-import org.onap.so.logger.MsoLogger;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -79,7 +82,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
this.processor = processor;
}
- protected static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowAsyncResource.class);
+ protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class);
protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time
/**
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 02cda8009f..8b35f0e6d6 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -36,6 +38,8 @@ import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackE
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
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;
import org.springframework.stereotype.Component;
@@ -54,7 +58,7 @@ import io.swagger.annotations.ApiOperation;
@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess")
@Component
public class WorkflowMessageResource{
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowMessageResource.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class);
private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
@Autowired
@@ -78,7 +82,7 @@ public class WorkflowMessageResource{
MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlator, "N/A");
- LOGGER.debug(LOGMARKER + " Received workflow message"
+ logger.debug(LOGMARKER + " Received workflow message"
+ " type='" + messageType + "'"
+ " correlator='" + correlator + "'"
+ (contentType == null ? "" : " contentType='" + contentType + "'")
@@ -86,17 +90,17 @@ public class WorkflowMessageResource{
if (messageType == null || messageType.isEmpty()) {
String msg = "Missing message type";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
+ logger.debug(LOGMARKER + " " + msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
if (correlator == null || correlator.isEmpty()) {
String msg = "Missing correlator";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
+ logger.debug(LOGMARKER + " " + msg);
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
@@ -121,4 +125,4 @@ public class WorkflowMessageResource{
return Response.status(204).build();
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index 5afd7e00e8..b1062962a6 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -29,15 +31,16 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
-import org.onap.so.logger.MsoLogger;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@Service
public class WorkflowProcessor extends ProcessEngineAwareService {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class);
protected static final String logMarker = "[WRKFLOW-RESOURCE]";
@Async
@@ -55,21 +58,17 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
// Note: this creates a random businessKey if it wasn't specified.
String businessKey = getBusinessKey(inputVariables);
- msoLogger.debug("***Received MSO startProcessInstanceByKey with processKey: " + processKey
- + " and variables: " + inputVariables);
+ logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey,
+ inputVariables);
RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey,
inputVariables);
processInstanceId = processInstance.getId();
- msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
+ logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
+ (processInstance.isEnded() ? "ENDED" : "RUNNING"));
} catch (Exception e) {
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- logMarker + "Error in starting the process: " + e.getMessage());
-
WorkflowResponse workflowResponse = new WorkflowResponse();
workflowResponse.setResponse("Error occurred while executing the process: " + e);
workflowResponse.setProcessInstanceID(processInstanceId);
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 c2a7f41140..92f1b7a816 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
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -50,6 +52,8 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
@@ -61,7 +65,7 @@ import io.swagger.annotations.ApiOperation;
@Component
public class WorkflowResource extends ProcessEngineAwareService {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowResource.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class);
private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
private static final int DEFAULT_WAIT_TIME = 30000;
@@ -99,7 +103,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
try {
//Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
+ ProcessThread thread = new ProcessThread(inputVariables,processKey);
thread.start();
Map<String, Object> responseMap = null;
@@ -141,7 +145,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
processInstance = thread.getProcessInstance();
if (processInstance == null) {
- msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
+ logger.debug("{} process has not been created yet", LOGMARKER + processKey );
continue;
}
@@ -151,7 +155,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
if (responseMap == null) {
- msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
+ logger.debug("{} has not produced a response yet", LOGMARKER + processKey);
if (timeProcessEnded.longValue() != 0) {
long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
@@ -192,14 +196,15 @@ public class WorkflowResource extends ProcessEngineAwareService {
workflowResponse.setMessageCode(500);
return Response.status(500).entity(workflowResponse).build();
} catch (Exception ex) {
- msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
+ logger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
workflowResponse.setMessage("Fail" );
workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
- + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
+ MsoLogger.ErrorCode.UnknownError.getValue(),
+ LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: "
+ + workflowResponse.getResponse());
workflowResponse.setMessageCode(500);
recordEvents(processKey, workflowResponse, startTime);
@@ -222,21 +227,13 @@ public class WorkflowResource extends ProcessEngineAwareService {
try {
return Integer.parseInt(timeout)*1000;
} catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
+ logger.debug("Invalid input for mso-service-request-timeout");
}
}
return DEFAULT_WAIT_TIME;
}
private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
}
private void setLogContext(String processKey, Map<String, Object> inputVariables) {
@@ -266,7 +263,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
try {
return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
} catch (Exception e) {
- msoLogger.debug("Exception :",e);
+ logger.debug("Exception :",e);
return true;
}
}
@@ -287,7 +284,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
try {
workflowResponse.setMessageCode(Integer.parseInt(responseCode));
} catch(NumberFormatException nex) {
- msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
+ logger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
workflowResponse.setMessageCode(-1);
}
@@ -298,7 +295,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
} else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
workflowResponse.setMessage("Fail");
} else {
- msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
+ logger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
workflowResponse.setMessage("Fail");
}
}
@@ -310,15 +307,13 @@ public class WorkflowResource extends ProcessEngineAwareService {
private class ProcessThread extends Thread {
private final Map<String,Object> inputVariables;
private final String processKey;
- private final MsoLogger msoLogger;
private final String businessKey;
private ProcessInstance processInstance = null;
private Exception exception = null;
- public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
+ public ProcessThread(Map<String, Object> inputVariables, String processKey) {
this.inputVariables = inputVariables;
this.processKey = processKey;
- this.msoLogger = msoLogger;
this.businessKey = UUID.randomUUID().toString();
}
@@ -352,14 +347,6 @@ public class WorkflowResource extends ProcessEngineAwareService {
long startTime = System.currentTimeMillis();
try {
- msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
- + " processKey:" + processKey
- + " businessKey:" + businessKey
- + " variables: " + inputVariables);
RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
@@ -370,7 +357,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
processKey, inputVariables);
} catch (Exception e) {
- msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
+ logger.debug(LOGMARKER + "ProcessThread caught an exception executing "
+ processKey + ": " + e);
setException(e);
}
@@ -441,7 +428,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
responseMapVariable);
if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ logger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ " from process " + processInstanceId + " history");
return responseMap;
}
@@ -455,12 +442,12 @@ public class WorkflowResource extends ProcessEngineAwareService {
// Check for 'WorkflowResponse' variable
Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
- msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
+ logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
if (workflowResponse != null) {
Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
responseMap = new HashMap<>();
responseMap.put("WorkflowResponse", workflowResponse);
responseMap.put("ResponseCode", responseCode);
@@ -496,17 +483,17 @@ public class WorkflowResource extends ProcessEngineAwareService {
}
}
- msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
+ logger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
// BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
String response = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
+ logger.debug(LOGMARKER + processKey + "Response: " + response);
if (response != null) {
object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
responseMap = new HashMap<>();
responseMap.put("Response", response);
responseMap.put("ResponseCode", responseCode);
@@ -516,12 +503,12 @@ public class WorkflowResource extends ProcessEngineAwareService {
object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
String errorResponse = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
+ logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
if (errorResponse != null) {
object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
responseMap = new HashMap<>();
responseMap.put("Response", errorResponse);
responseMap.put("ResponseCode", responseCode);
@@ -545,7 +532,7 @@ public class WorkflowResource extends ProcessEngineAwareService {
return runtimeService.getVariable(executionId, variableName);
} catch (ProcessEngineException e) {
// Most likely cause is that the execution no longer exists.
- msoLogger.debug("Error retrieving execution " + executionId
+ logger.debug("Error retrieving execution " + executionId
+ " variable " + variableName + ": " + e);
return null;
}
@@ -562,8 +549,8 @@ public class WorkflowResource extends ProcessEngineAwareService {
.processInstanceId(processInstanceId).variableName(variableName).singleResult();
return v == null ? null : v.getValue();
} catch (Exception e) {
- msoLogger.debug("Error retrieving process " + processInstanceId
- + " variable " + variableName + " from history: " + e);
+ logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId,
+ variableName, e);
return null;
}
}
@@ -589,42 +576,27 @@ public class WorkflowResource extends ProcessEngineAwareService {
variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
}
- msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
- + processKey + " and variables: "
- + variablesMap.toString());
-
+ logger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " +
+ variablesMap.toString());
response.setVariables(variablesMap);
response.setMessage("Success");
response.setResponse("Successfully retrieved the variables");
response.setProcessInstanceID(processInstanceId);
- msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse());
+ logger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response
+ .getResponse());
} catch (Exception ex) {
response.setMessage("Fail");
response.setResponse("Failed to retrieve the variables," + ex.getMessage());
response.setProcessInstanceID(processInstanceId);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
- + response.getMessage()
- + " for processKey: "
- + processKey
- + " with response: "
- + response.getResponse());
- msoLogger.debug("Exception :",ex);
+
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey),
+ MsoLogger.ErrorCode.UnknownError.getValue(),
+ LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response
+ .getResponse());
+ logger.debug("Exception :",ex);
}
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
-
return response;
}
}
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 5435194f39..62aad7e345 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -56,7 +58,8 @@ import org.onap.so.bpmn.core.BPMNLogger;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.slf4j.MDC;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.AbstractEnvironment;
import org.springframework.core.env.Environment;
@@ -279,7 +282,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
* Logs details about the current activity.
*/
public class LoggingExecutionListener implements ExecutionListener {
- private final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,LoggingExecutionListener.class);
+ private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class);
private String event;
@@ -317,7 +320,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
MsoLogger.setLogContext(requestId, svcid);
}
} catch(Exception e) {
- logger.error(e);
+ logger.error("Exception occurred", e);
}
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index 62be1330b1..cb20ded8de 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -36,10 +38,11 @@ import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -52,7 +55,7 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@Configuration
public class CXFConfiguration {
- private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class);
+ private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class);
@Autowired
private Bus bus;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 7956ecc363..af9ab2899e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -28,8 +30,9 @@ import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -52,8 +55,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) })
public class MSOInfrastructureApplication {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- MSOInfrastructureApplication.class);
+ private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
@Value("${mso.async.core-pool-size}")
private int corePoolSize;
@@ -81,20 +83,11 @@ public class MSOInfrastructureApplication {
@PostDeploy
public void postDeploy(ProcessEngine processEngineInstance) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Post deployment complete...");
}
@PreUndeploy
public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
List<ProcessEngine> processEngines) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Pre Undeploy complete...");
-
}
@Bean
@@ -109,4 +102,4 @@ public class MSOInfrastructureApplication {
executor.initialize();
return executor;
}
-} \ No newline at end of file
+}