Intellij JUnit测试运行将spring-boot-starter-log4j2添加到类路径

时间:2018-07-17 19:52:26

标签: maven spring-boot intellij-idea junit5

使用spring-boot-starter-web,但希望通过log4j使用logback。如果我从maven命令行运行集成测试,那一切都很好,但是当我尝试从IntelliJ调试器运行它们的测试时,就会发现堆栈溢出。

在cmd行上运行

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

在IntelliJ中运行

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

因此,从IntelliJ运行时,它会拾取错误的jar。 对于在命令行上显示slf4j-jdk14感到不满意,但是它来自maven-parameter-documenter,所以对此并不感到担心,但我希望能够在IntelliJ中调试我的测试。

0 个答案:

没有答案