Monday, 6 October 2014

Spring Javaconfig Logback

This post shows how to add logging to a basic Spring project using Logback and slf4j.

This builds on the Minimal REST Api  project.

Maven Dependencies

Logback Configuration

Add this to src/main/resources/logback.xml



Logback shutdown gotcha

Until this has been fixed, using the SMTP appender in logback prevents tomcat from shutting down. Add the following to your context configuration to shut down properly:


Controller updates

Now you can update the controller to print some logging: