【发布时间】:2015-06-24 22:01:16
【问题描述】:
我正在使用 Spring Boot,并且想完全禁用自动日志记录配置并直接使用 SLF4J 和 logback。
我尝试了以下方法:
@EnableAutoConfiguration(exclude={LoggingApplicationListener.class})
这没有用。有没有办法完全禁用 spring boot 日志配置?
【问题讨论】:
标签: java spring spring-boot
我正在使用 Spring Boot,并且想完全禁用自动日志记录配置并直接使用 SLF4J 和 logback。
我尝试了以下方法:
@EnableAutoConfiguration(exclude={LoggingApplicationListener.class})
这没有用。有没有办法完全禁用 spring boot 日志配置?
【问题讨论】:
标签: java spring spring-boot
如果您不想配置JAVA_OPTS,您可以覆盖SpringBootServletInitializer 的行为,如Spring Boot: LoggingApplicationListener interfering with Application Server logging 中所述
【讨论】:
查看 Dave Syer 的回答。我认为删除 Spring Boot 默认日志配置是您能做的最好的事情。
【讨论】:
我相信 Spring 使用的属性会覆盖默认设置的配置和您正在使用的注释。
我曾经遇到过同样的问题,我通过指定以下内容解决了它:
-Dlogging.config=log4j-live.xml -Dlog4j.debug
让我知道这是否适合你。
【讨论】: