首页 > 其他分享 >Spring Boot 运行的时候提示日志错误

Spring Boot 运行的时候提示日志错误

时间:2022-08-25 19:13:17浏览次数:97  
标签:Spring Boot slf4j apache org 日志 log4j

提示的错误信息为:

Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.apache.logging.slf4j.Log4jLoggerFactory loaded from file:/C:/Users/yhu/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.8.2/log4j-slf4j-impl-2.8.2.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.apache.logging.slf4j.Log4jLoggerFactory

错误界面如下:

 

2022-08-24_17-33-03

 

问题和解决

这个又是典型的 Spring Boot 版本冲突的问题。

在 Pom 文件中,可能有 Log4j 的包。

这个会导致 Spring Boot 没有办法绑定日志。

在我们的项目中就是因为绑定了下面的版本而导致的错误:

 

2022-08-24_17-36-21

 

如果我们上面的内容从 Pom 文件中删除后,问题解决了。

 

https://www.ossez.com/t/spring-boot/14069

标签:Spring,Boot,slf4j,apache,org,日志,log4j
From: https://www.cnblogs.com/huyuchengus/p/16625418.html

相关文章