Spring启动时禁用日志系统调试(配置转储)

时间:2014-10-22 14:11:30

标签: java spring-boot logback

默认情况下,Spring Boot会转储日志系统配置(例如log4j' s -Dlog4j.debug已设置,与logback相同),这意味着每个应用程序都以详细而非超级有用的消息开头,同时阅读配置文件本身:

16:03:08,167 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
16:03:08,167 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
16:03:08,309 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
16:03:08,309 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
16:03:08,309 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
...
...

有没有办法禁用它,而无需手动设置系统属性?

1 个答案:

答案 0 :(得分:0)

生成该输出以警告您配置存在问题。您需要将<layout>替换为等效配置的<encoder>。警告消息中链接到的Logback文档包含更多信息:http://logback.qos.ch/codes.html#layoutInsteadOfEncoder