【发布时间】:2016-08-09 15:32:34
【问题描述】:
尝试在 SpringBoot + Gradle 项目中启用 log4j 不如 Maven 常见。所以,这是我面临的问题:
gradle clean bootRun --stacktrace
:clean
:compileJava
:processResources
:classes
:findMainClass
:bootRun
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/mdesales/.m2/repository/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/mdesales/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
Exception in thread "main" java.lang.ExceptionInInitializerError
问题
- 如何使用 Gradle 解决?
- 如何使用 Log4j 1.x 而不是 http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging 中记录的 Log4j2?
- 如何在 SpringBoot 中按原样重用现有的 log4j.xml,而不进行更改?
【问题讨论】:
标签: gradle spring-boot log4j slf4j