Skip to content
Snippets Groups Projects
Commit 72e68d07 authored by Tucker Gary Siegel's avatar Tucker Gary Siegel
Browse files

logging-update

parent 46476903
No related branches found
No related tags found
1 merge request!1update service log type to include exception message
...@@ -32,8 +32,11 @@ public class CustomExceptionHandler { ...@@ -32,8 +32,11 @@ public class CustomExceptionHandler {
private ResponseEntity<Object> returnDawnException(DawnException exception) { private ResponseEntity<Object> returnDawnException(DawnException exception) {
if (exception.getBase() != null) { if (exception.getBase() != null) {
MDC.put("stackTrace", getStackTrace(exception.getBase())); MDC.put("stackTrace", getStackTrace(exception.getBase()));
MDC.put("exceptionMessage", exception.getBase().getMessage());
} else { } else {
MDC.put("stackTrace", getStackTrace(exception)); MDC.put("stackTrace", getStackTrace(exception));
MDC.put("exceptionMessage", exception.getMessage());
// MDC.put("exceptionMessage", exception.)
} }
log.error(exception.getMessage()); log.error(exception.getMessage());
MDC.remove("stackTrace"); MDC.remove("stackTrace");
......
...@@ -23,6 +23,7 @@ public class ServiceLog extends Log { ...@@ -23,6 +23,7 @@ public class ServiceLog extends Log {
private String message; private String message;
private String stackTrace; private String stackTrace;
private String exceptionMessage;
private String origin; private String origin;
public static ServiceLog fromLogEvent(LogEvent event) { public static ServiceLog fromLogEvent(LogEvent event) {
...@@ -30,6 +31,7 @@ public class ServiceLog extends Log { ...@@ -30,6 +31,7 @@ public class ServiceLog extends Log {
.level(event.getLevel().name()) .level(event.getLevel().name())
.message(event.getMessage().toString()) .message(event.getMessage().toString())
.stackTrace(event.getContextData().getValue("stackTrace")) .stackTrace(event.getContextData().getValue("stackTrace"))
.exceptionMessage(event.getContextData().getValue("exceptionMessage"))
.origin(event.getLoggerName()) .origin(event.getLoggerName())
.build(); .build();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment