【发布时间】:2020-05-21 16:53:20
【问题描述】:
更新 Spring 库后,我看到以下异常:
java.lang.ClassCastException: org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog 不能 转换为 org.apache.commons.logging.impl.Log4JLogger
感谢您的有益想法。
【问题讨论】:
更新 Spring 库后,我看到以下异常:
java.lang.ClassCastException: org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog 不能 转换为 org.apache.commons.logging.impl.Log4JLogger
感谢您的有益想法。
【问题讨论】:
我发现了问题。这是因为 spring.jcl jar 支持 log 2.x,但目前,我使用的是 1.x,删除 jar 使其工作。
Spring Framework 5.0 自带了开箱即用的 Commons Logging 桥: spring-jcl 而不是标准的 Commons Logging;仍然是可排他的/可覆盖的。 无需任何额外网桥即可自动检测 Log4j 2.x、SLF4J、JUL (java.util.logging)。
【讨论】: