From 80da6ea3e2867b462e0007b9337e97fd5cc38816 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Fri, 10 Aug 2018 09:34:12 -0400 Subject: Improve Logging Add Stack trace to be logged, currently only a generic error message is logged Issue-ID: SO-846 Change-Id: I8479247227cf08de25bece5077003ee83c08472d Change-Id: I8479247227cf08de25bece5077003ee83c08472d Signed-off-by: Smokowski, Steve (ss835w) --- .../org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java') 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 e0bcc71736..0e581cb48a 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 @@ -63,7 +63,7 @@ public class ApiExceptionMapper implements ExceptionMapper { errorText = errorText.substring(0, 1999); } - writeErrorLog(errorText, errorLoggerInfo, alarmLoggerInfo); + writeErrorLog(exception, errorText, errorLoggerInfo, alarmLoggerInfo); return buildServiceErrorResponse(errorText,messageId,variables); @@ -96,8 +96,9 @@ public class ApiExceptionMapper implements ExceptionMapper { return requestErrorStr; } - protected void writeErrorLog(String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { - + protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo, AlarmLoggerInfo alarmLogInfo) { + if( e!= null) + logger.error(e); if(errorLogInfo != null) logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText); if(alarmLogInfo != null){ -- cgit 1.2.3-korg