gpt4 book ai didi

logging - 排除 ch.qos.logback 溢出

转载 作者:行者123 更新时间:2023-12-03 05:53:53 27 4
gpt4 key购买 nike

我正在使用:

compile (libs.spring_boot_starter_logging)
testCompile 'org.apache.qpid:qpid-broker:0.28'

他们都有一个 SLF4J 绑定(bind),所以我有错误:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/maciej.glowala.ext/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.1.11/ccedfbacef4a6515d2983e3f89ed753d5d4fb665/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/maciej.glowala.ext/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.6.4/6b4973e0320e220ec6534478d60233fd1cc51c9b/slf4j-log4j12-1.6.4.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]

我可以从 qpid-broker 中排除版本 1.6.4 但它会出错,因为代理找不到包含在较新版本中的某些方法。当我想排除版本 1.1.11
compile (libs.spring_boot_starter_logging){
exclude group: 'ch.qos.logback', module: 'logback-classic'
}

我有一个溢出错误
java.lang.StackOverflowError
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:39)
at org.apache.log4j.LogManager.getLogger(LogManager.java:45)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:64)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.apache.log4j.Category.<init>(Category.java:57)
at org.apache.log4j.Logger.<init>(Logger.java:37)
at org.apache.log4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:43)
at org.apache.log4j.LogManager.getLogger(LogManager.java:45)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:64)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.apache.log4j.Category.<init>(Category.java:57)
at org.apache.log4j.Logger.<init>(Logger.java:37)
.
.
.

更重要的是,我不应该从 compile 中排除。当 SLF4J绑定(bind)包含在 testCompile 中所以我想排除测试只使用
configurations {
testCompile.exclude group:'ch.qos.logback'
}

但无论如何我仍然有同样的溢出错误。任何人都可以帮助我如何设置 build.gradle 以使用更新版本进行测试?

最佳答案

如果将来有人需要它,请通过附加排除解决它:

testCompile.exclude group:'org.slf4j', module:'log4j-over-slf4j'

关于logging - 排除 ch.qos.logback 溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46158724/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com