springboot项目启动时日志依赖冲突:SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding
in [jar:file:/D:/response/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar
!/org/slf4j/impl/StaticLoggerBinder.class
]
SLF4J: Found binding
in [jar:file:/D:/response/org/apache/logging/log4j/log4j-slf4j-impl/2.13.3/log4j-slf4j-impl-2.13.3.jar
!/org/slf4j/impl/StaticLoggerBinder.class
]
SLF4J: See http://www.slf4j.org/codes.html
SLF4J: Actual binding is of
type [ch.qos.logback.classic.util.ContextSelectorStaticBinder
]
关于这个错误主要要看哪个jar包有冲突,然后在idea可以用快捷键clt+alt+u查看maven上的依赖关系(记得安装maven插件 maven helper),然后找出这俩依赖中的一个,排出一个包中的log4j-slf4j-impl,或者logback-classic依赖
格式如下
<dependency>
<groupId>org.springframework.boot
</groupId>
<artifactId>spring-boot-starter-log4j2
</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j
</groupId>
<artifactId>log4j-slf4j-impl
</artifactId>
</exclusion>
</exclusions>
</dependency>