I'm having trouble with Spring Boot spitting DEBUG level log items to terminal, when it should be in INFO level.
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
<logger name="org.springframework.web" level="WARN"/>
</configuration>
Dependencies in pom.xml (omitted everything that doesn't concern logging)
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Logging -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
</dependencies>
The lines that keep showing up in terminal
20:01:00.937 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [servletConfigInitParams]
20:01:00.937 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [servletContextInitParams]
20:01:00.937 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [systemProperties]
20:01:00.937 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [systemEnvironment]
20:01:00.937 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [random]
20:01:00.937 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [applicationConfig: [classpath:/application.properties]]
20:01:00.938 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [class path resource [sql.properties]]
20:01:00.938 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'serverServletmapping' in [localProperties]
20:01:00.938 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'serverServletmapping' in any property source. Returning [null]
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [servletConfigInitParams] PropertySource with lowest search precedence
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [servletContextInitParams] PropertySource with lowest search precedence
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [systemProperties] PropertySource with lowest search precedence
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [systemEnvironment] PropertySource with lowest search precedence
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [random] PropertySource with lowest search precedence
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [applicationConfig: [classpath:/application.properties]] PropertySource with lowest search precedence
20:01:00.938 [main] DEBUG o.s.core.env.MutablePropertySources - Adding [class path resource [sql.properties]] PropertySource with lowest search precedence
It looks like logback did not find your logback.xml
file. Please refer to logback documentation on config file location .
Configuration files such as
logback.groovy
,logback-test.xml
orlogback.xml
can be located directly under any folder declared in the class path. For example, if the class path readsc:/java/jdk15/lib/rt.jar;c:/mylibs/
then thelogback.xml
file should be located directly underc:/mylibs/
, that is asc:/mylibs/logback.xml
.Placing it under a sub-folder of
c:/mylibs/
, say,c:/mylibs/other/
, will not work.For web-applications, configuration files can be placed directly under WEB-INF/classes/ .
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
add this filter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.