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

**URL:** <https://www.isharkfly.com/t/spring-boot/14069>\
**Category:** 程序语言\
**Tags:** java, spring\
**Created:** [August 24, 2022, 9:36pm UTC](https://www.isharkfly.com/t/spring-boot/14069 "2022-08-24T21:36:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [August 24, 2022, 9:36pm UTC](https://www.isharkfly.com/t/spring-boot/14069/1 "2022-08-24T21:36:58Z")

</div>

提示的错误信息为：

`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](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/1/1dd5c5a95de24496c6131227844dfcaf728d78bc.png)

## 问题和解决

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

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

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

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

 ![2022-08-24_17-36-21](https://com-ossez-www-discourse.s3.dualstack.us-east-2.amazonaws.com/discourse-uploads/original/2X/f/fad00a47f673527a62f52269e7bc22057bb0597b.png)

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