Spring boot properties difference between `debug=true` and `logging.level.root=debug`

Viewed 750

is there any difference between debug=true and logging.level.root=debug , both are specified in application.properties file of spring boot application.

Below are references for both from spring boot documentation, unfortunately there they don't show any link between them but it looks like they serve same purpose.

https://docs.spring.io/spring-boot/docs/2.6.6/reference/htmlsingle/#features.logging.console-output

https://docs.spring.io/spring-boot/docs/2.6.6/reference/htmlsingle/#features.logging.log-levels

1 Answers

When you set debug=true a bunch of "core" loggers used under the hood by spring boot will be set to debug: web container (like a tomcat), spring boot itself, hibernate.

It won't affect the loggers of your application though - they'll still be at INFO severity level.

However, if you set something like logging.level.root=debug probably all the loggers will be set to DEBUG, so yes, technically there is a difference.

From the spring boot documentation:

When the debug mode is enabled, a selection of core loggers (embedded container, Hibernate, and Spring Boot) are configured to output more information. Enabling the debug mode does not configure your application to log all messages with DEBUG level.

Related