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.
1 Answer
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.
-
Hmm. I get the exception message logged (and the class that produced the log), but not the full stack trace. I haven't configured anything about the logging yet -- just using the defaults. Jun 25, 2015 at 12:58
-
I do use the SLF4J Logger from the classpath, but that just uses Logback behind the scenes, right? Jun 25, 2015 at 12:59
-
Yes, that's correct. Maybe they have changed the default behaviour, i can check that tomorrow.– dunniJun 25, 2015 at 16:29