davpin / cf-SpringBootTrader

Microservice version of the Spring Trader app using Spring Boot and Spring Cloud.
Apache License 2.0
104 stars 107 forks source link

Log exception stacktraces as a single loggregator log message #12

Closed mrdavidlaing closed 8 years ago

mrdavidlaing commented 8 years ago

Log messages split over several lines (such as Java Exception stacktraces) get split into multiple messages by Cloud Foundry's loggregator.

Its nearly impossible to reassemble these related lines into a single line in a log aggregation system (like logstash), because the order of the logs can get mixed up.

This PR extends spring boot's default logback configuration so that exceptions are logged using the unicode newline character (u2028) rather than \n; causing loggregator to group all the stack trace lines in a single log message.

In the downstream log processor it is reasonably simple to convert u2028 back to \n, resulting in readable stack traces in UIs like Kibana:

screen shot 2015-08-20 at 09 20 36

This PR replaces https://github.com/dpinto-pivotal/cf-SpringBootTrader/pull/10