LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logba...

简介: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath.

LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/jack/.m2/repository/com/alibaba/external/org.slf4j.slf4j-log4j12/1.5.2/org.slf4j.slf4j-log4j12-1.5.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jack/.m2/repository/org/slf4j/slf4j-nop/1.7.25/slf4j-nop-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jack/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/jack/.m2/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x.

日志:

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.slf4j.helpers.NOPLoggerFactory loaded from file:/Users/jack/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.helpers.NOPLoggerFactory
at org.springframework.util.Assert.instanceCheckFailed(Assert.java:389)
at org.springframework.util.Assert.isInstanceOf(Assert.java:327)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:274)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:98)
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:231)
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:210)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:292)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.alibaba.microtek.ApplicationKt.main(Application.kt:28)
... 6 more

大概就是说Logback已经在classpath中存在,这时候就应该意识到有Logback依赖冲突,在多个地方都有Logback的依赖。

相关文章
|
Java API 网络性能优化
NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
报错日志: java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy at ch.
11205 0
|
5月前
|
JavaScript 前端开发 Java
若依部署-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_error]
若依部署-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_error]
|
6月前
|
Java API Maven
解决SLF4J和logback报错SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.
解决SLF4J和logback报错SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.
|
6月前
|
Java 程序员
SpringBoot集成log4j2出现Logback configuration error detected: current ElementPath is
SpringBoot集成log4j2出现Logback configuration error detected: current ElementPath is
102 0
|
Java 数据库连接 API
快速了解常用日志技术(JCL、Slf4j、JUL、Log4j、Logback、Log4j2)
快速了解常用日志技术(JCL、Slf4j、JUL、Log4j、Logback、Log4j2)
150 0
|
Java Maven
SpringBoot中使用SLE4J日志框架启动报错:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinde
SpringBoot中使用SLE4J日志框架启动报错:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinde
467 1
|
分布式计算 Hadoop
SLF4J:Failed to load class org.slf4j.impl.StaticLoggerBinder.
SLF4J:Failed to load class org.slf4j.impl.StaticLoggerBinder.
238 0
|
Java Maven
Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log 解决方法
org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:400) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.jav
240 0
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.
131 0
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder“.
(六)Logback中的Filter
规律型过滤器继承自Filter抽象类,该类主要由带有ILoggingEvent参数的decide()方法组成。多个过滤器会基于三进制规则进行排序,每个过滤器的decide(ILoggingEvent event)方法依次会被调用,该方法返回FilterReply的枚举值,例如:DENY、NEUTRAL、ACCEPT。如果方法返回值为DENY,那么日志对象会被终止而不会被其它过滤器访问。