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

提示的错误信息为:

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

错误界面如下:

 

 

问题和解决

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

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

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

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

 

 

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

 

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

posted @   huyuchengus  阅读(781)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 2 本地部署DeepSeek模型构建本地知识库+联网搜索详细步骤
历史上的今天:
2021-08-25 IntelliJ IDEA 如何显示提交输入的信息历史
2021-08-25 JavaScript 有关数组的 slice 截断函数
点击右上角即可分享
微信分享提示