Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simple way to enable stack traces in Spring Boot logging?

Tags:

spring-boot

I want to see more than just the Exception's message string in my logs -- a full stack trace would be preferable. Is there an easy way to do this, or do I have to delve into Logback custom classes? I'd rather just set a config option somewhere.

like image 900
Sam Jones Avatar asked Nov 09 '22 10:11

Sam Jones


1 Answers

You have to add the exception to the pattern for Logback. According to the logback documentation you can either add %ex or %xEx. If you haven't configured a custom logback configuration so far, exceptions should already be logged because the default logback configuration which comes with Spring Boot, contains these pattern keywords. If it doesn't work, there might be another problem.

like image 91
dunni Avatar answered Nov 15 '22 11:11

dunni