【发布时间】:2015-07-10 17:35:19
【问题描述】:
我在 Spring Boot 将 DEBUG 级别的日志项吐出到终端时遇到了问题,它应该处于 INFO 级别。
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>
pom.xml 中的依赖项 (省略了与日志记录无关的所有内容)
<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>
终端中不断出现的行
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
【问题讨论】:
-
你在application.properties或application.yml中有日志配置吗?
-
@AndyWilkinson Wilkinson 不,application.properties 完全为空,application.yml 不存在。
标签: java spring maven spring-boot logback