diff options
author | Bhatt, Prema <prema.bhatt@att.com> | 2019-06-11 10:21:56 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-06-11 10:22:02 -0400 |
commit | 3ea6fb09785b55fc4318ce583038dbea3e093abe (patch) | |
tree | 5b4a206c0008f116dd7eda1e149153cb506c008b /mso-api-handlers/mso-api-handler-common/src | |
parent | c73fbf69cd7e66feca1ebfb35b8516bb183c585b (diff) |
update logger statements in apih
Corrected arguments to logger methods
only log exception in catch blocks
Change-Id: I0657b00ce45ac543d5e900db6ce5c24ba34e345d
Issue-ID: SO-2007
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src')
5 files changed, 8 insertions, 21 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index ae443983b8..5dd99f51cd 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -27,7 +27,6 @@ package org.onap.so.apihandler.common; import java.io.IOException; import java.util.UUID; import javax.xml.bind.DatatypeConverter; -import org.onap.so.logger.LoggingAnchor; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; @@ -38,8 +37,6 @@ import org.onap.so.apihandler.camundabeans.CamundaInput; import org.onap.so.apihandler.camundabeans.CamundaIntegerInput; import org.onap.so.apihandler.camundabeans.CamundaRequest; import org.onap.so.apihandler.camundabeans.CamundaVIDRequest; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -162,8 +159,7 @@ public class CamundaClient extends RequestClient { jsonReq = mapper.writeValueAsString(camundaRequest); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + logger.error("Error in APIH Warp request", e); } return jsonReq; } @@ -253,8 +249,7 @@ public class CamundaClient extends RequestClient { jsonReq = mapper.writeValueAsString(camundaRequest); logger.trace("request body is {}", jsonReq); } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest", - ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e); + logger.error("Error in APIH Warp request", e); } return jsonReq; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java index ad8cc3f250..e2ea021811 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java @@ -52,7 +52,7 @@ public class PathResourceResolver implements LSResourceResolver { try { stream = new FileInputStream(path + systemId); } catch (FileNotFoundException e) { - logger.debug("Could not resolve resource based on file: {}", path + systemId, e); + logger.debug("Could not resolve resource based on file: ", e); } input.setPublicId(publicId); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java index 34077e6ad3..2b08d1130f 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java @@ -31,10 +31,7 @@ import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; -import org.onap.so.logger.LoggingAnchor; import org.apache.commons.io.IOUtils; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; @@ -95,8 +92,7 @@ public class XMLValidator { return "ErrorDetails: " + e.getMessage(); } catch (Exception e) { - logger.error(LoggingAnchor.THREE, MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(), - ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e); + logger.error("APIH cannot read schema file", e); return "ErrorDetails: " + "Unable to read the schema file"; } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java index 399e0650f9..a1c1dd1cc4 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java @@ -52,7 +52,7 @@ public class RequestIdFilter implements ContainerRequestFilter { if (infraActiveRequests != null) { MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(HttpStatus.SC_BAD_REQUEST)); - logger.error("RequestID exists in RequestDB.InfraActiveRequests : " + requestId); + logger.error("RequestID exists in RequestDB.InfraActiveRequests : {}", requestId); } } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java index 0d928cbb0c..66b86a6961 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java @@ -36,18 +36,15 @@ import javax.ws.rs.ext.Provider; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; -import org.onap.so.logger.LoggingAnchor; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; -import org.onap.so.logger.ErrorCode; -import org.onap.so.logger.MessageEnum; import org.onap.so.serviceinstancebeans.RequestError; import org.onap.so.serviceinstancebeans.ServiceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; @Provider public class ApiExceptionMapper implements ExceptionMapper<ApiException> { @@ -135,8 +132,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { } catch (JsonProcessingException | JAXBException e) { String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage(); - logger.error(LoggingAnchor.FOUR, MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse", - ErrorCode.DataError.getValue(), errorMsg, e); + logger.error("BuildServiceErrorResponse", e); return errorMsg; } |