如何解决如何在Springboot项目中摆脱SLF4J绑定
按照其他答案,我确实排除了这个问题,但是我开始得到 ERROR An exception occurred processing Appender http java.lang.IllegalArgumentException:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
我需要修复SLF4J绑定,因为它阻止了我的日志发送到Splunk:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/app.jar!/BOOT-INF/lib/logback-classic-
1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/app.jar!/BOOT-INF/lib/log4j-slf4j-impl-
2.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
解决方法
使用maven命令检查依赖关系树:
mvn dependency:tree
您将在此处找到提供现有SL4J绑定的依赖项。然后只需将排除项更改为此。
此处提供更多信息:Spring Boot: multiple SLF4J bindings
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。