Logging Configuration in Spring Boot

In this tutorial I will show you how to override Spring Boot’s default logging mechanism by creating logback.xml file under src/main/resources directory.

You may also read Simple log4j configuration in java and Log4j Configurations – Controlling Logging to Multiple Files

By default, slf4j logging is already included in the Spring Boot application, you just need to enable it.

To enable logging, create a application.properties file in the root of the src/main/resources folder.
Continue reading “Logging Configuration in Spring Boot”

Log4j Configurations – Controlling Logging to Multiple Files


The purpose of inserting log statements into the code is a low-tech method for debugging it. It may also be the only way because debuggers are not always available or applicable. This is often the case for distributed applications.
Features of Log4j

We can enable logging at runtime without modifying the application binary.

We can control the behavior of logging by editing only the configuration file, no need to touch the application binary.

Developer are always clear with detailed context for application failures.

Log4j has one of the distinctive features – the notion of inheritance. Using this logger hierarchy feature we are able to control the log statements output at arbitrarily fine granularity but also at great ease. This helps to reduce the volume of logged output and the cost of logging. Continue reading “Log4j Configurations – Controlling Logging to Multiple Files”