Spring maven项目在旧版本IDEA运行正常,新版IDEA报错 java.lang.IllegalStateException: Logback configuration error detected


1. 旧版IDEA 

IntelliJ IDEA 2018.2.3 (Community Edition)
Build #IC-182.4323.46, built on September 4, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

2. 新版IDAE(不是最新版,只是比旧版新而已)

IntelliJ IDEA 2021.1 (Community Edition)
Build #IC-211.6693.111, built on April 6, 2021
Runtime version: 11.0.10+9-b1341.35 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1526M
Cores: 4

Kotlin: 211-1.4.32-release-IJ6693.72

运行报错:

java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@996533593 - Timeouxxxxxx后面错误省略

解决办法:

将pom.xml中

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.logging.log4j</groupId>
                    <artifactId>log4j-to-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

  

提到  dependencies 的最前面

解释:pom文件的加载顺序也是从上至下执行,放到pom文件中的第一位,在向下执行的时候也会排除所有的默认logger了。

 

相关博文:https://www.jianshu.com/p/e674ea5c739b

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM