6

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 1

1

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.

3
  • 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.
    – Sam Jones
    Jun 25, 2015 at 12:58
  • I do use the SLF4J Logger from the classpath, but that just uses Logback behind the scenes, right?
    – Sam Jones
    Jun 25, 2015 at 12:59
  • Yes, that's correct. Maybe they have changed the default behaviour, i can check that tomorrow.
    – dunni
    Jun 25, 2015 at 16:29

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.