-
原因:slf4j-log4j12模块的目的是将对 SLF4J 的调用重定向到 log4j。log4j-over-slf4j模块的目的是将对 log4j 记录器的调用重定向到 SLF4J。如果 SLF4J 与
slf4j-log4j12.jar
绑定, 并且log4j-over-slf4j.jar
也存在于ClassPath中,第一次调用 SLF4J 或 log4j logger 后不可避免地会立即发生*Error
-
解决方案:
-
点击项目,Maven——Show Diagram
-
搜索slf4j-log4j12(这里我已经排除依赖了,就用log4j-to-slf4j举例子)
-
找到对应的依赖双击,再右键——Exclude即可
-
最后观察pom文件可以看到即可,重新启动项目即可
<dependency> <groupId>com.youzan.cloud</groupId> <artifactId>dennis-chain-baihuo-biz</artifactId> <version>${project.version}</version> <exclusions> <exclusion> <artifactId>slf4j-log4j12</artifactId> <groupId>org.slf4j</groupId> </exclusion> </exclusions> </dependency>
-
相关文章
- 11-26Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOv
- 11-26Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting *Error
- 11-2613.4 库依赖冲突问题:Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path