5

Spring Boot logging level

 3 years ago
source link: https://marco.dev/2018/08/30/spring-boot-logging-level/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to change the level of output in Spring Boot

Problem: When I’m testing my Spring application hundreds of lines of log code appear (DEBUG level).

The quantity of log is particularly important using Spring integration.

According to the spring documentation it should be possible to set the level of debug in the application.properties but the level of logs did not change.

The solution is to create a logback.xml in the classpath of the test ([PROJECT_ROOT]/src/test/resources):

2018-08-31_23-19-41.png

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<include resource="org/springframework/boot/logging/logback/base.xml"/>
	<logger name="org.springframework" level="INFO"/>
</configuration>

Before and after the change

Before:

log_2018-08-31_23-11-24.png
After:
log_2018-08-31_23-12-09.png

Documentation

Spring logging

Spring Logback.xml

Author

Marco Molteni

Marco Molteni Blog


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK