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
logback配置
一、logback介绍 logback分成三个模块:logback-core,logback- classic,logback-access。 logback-core:提供了logBack的核心功能,是另外两个组件的基础; logback-classic:实现了SLF4J API; logback
748 0
|
Java API 网络性能优化
NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
报错日志: java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy at ch.
11230 0
|
7月前
|
JavaScript 前端开发 Java
若依部署-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_error]
若依部署-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_error]
|
8月前
|
Java 程序员
SpringBoot集成log4j2出现Logback configuration error detected: current ElementPath is
SpringBoot集成log4j2出现Logback configuration error detected: current ElementPath is
120 0
|
XML 安全 Java
logback的使用和配置|logback比log4j的优点|logback是一个更好的log4j
logback的使用和配置|logback比log4j的优点|logback是一个更好的log4j
|
XML 安全 Oracle
logback的使用和logback.xml详解
logback的使用和logback.xml详解
461 0
|
监控 Java Shell
(二)Logback配置
Logback通过加载配置文件的方式来初始化配置,配置文件的加载顺序如下: 1)Logback首先会去类路径下找名为logback-test.xml的文件。 2)如果没有找到如上文件,会去类路径下找名为logback.groovy的文件。 3)如果没有找到如上文件,会去类路径下找名logback.xml的文件。
(二)Logback配置
(六)Logback中的Filter
规律型过滤器继承自Filter抽象类,该类主要由带有ILoggingEvent参数的decide()方法组成。多个过滤器会基于三进制规则进行排序,每个过滤器的decide(ILoggingEvent event)方法依次会被调用,该方法返回FilterReply的枚举值,例如:DENY、NEUTRAL、ACCEPT。如果方法返回值为DENY,那么日志对象会被终止而不会被其它过滤器访问。
(七)Logback中的MDC(Mapped Diagnostic Context)
审计和调试分布式应用是logback的设计目标之一,在多线程环境中,不同的线程会处理不同的客户端,为了区分不同客户端日志输出,一种轻量级但不可取的做法是为每个实例化一个新的、完全分离日志记录器,这种方法会产生很多的日志记录器而且难以管理。
|
Java Shell
Logback 配置
logback 会在类路径下寻找名为 logback-test.xml 的文件。 如果没有找到,logback 会继续寻找名为 logback.groovy 的文件。 如果没有找到,logback 会继续寻找名为 logback.xml 的文件。 如果没有找到,将会通过 JDK 提供的 ServiceLoader 工具在类路径下寻找文件 META-INFO/services/ch.qos.logback.classic.spi.Configurator,该文件的内容为实现了 Configurator 接口的实现类的全限定类名。 如果以上都没有成功,logback 会通过 BasicConfig
483 0