SLF4J:类路径包含多个SLF4J绑定

我收到以下错误。似乎有多个绑定到sl4j的日志记录框架。不确定如何解决此问题。任何帮助是极大的赞赏。


SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/C:/Users/admin/.m2/repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/C:/Users/admin/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.


慕码人2483693
浏览 1979回答 3
3回答

慕哥6287543

通过在导致冲突的(pom.xml)依赖项中添加以下排除项来解决。<exclusions>&nbsp; &nbsp; <exclusion>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.slf4j</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>slf4j-log4j12</artifactId>&nbsp; &nbsp; </exclusion></exclusions>&nbsp;

慕虎7371278

摇篮版本;configurations.all {&nbsp; &nbsp; exclude module: 'slf4j-log4j12'}

慕妹3146593

该错误可能会提供更多类似的信息(尽管您的jar名称可能不同)SLF4J:在[jar:file:/ D:/Java/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/ org / slf4j / impl / StaticLoggerBinder中找到绑定.class] SLF4J:在[jar:file:/ D:/Java/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.8.2/log4j-slf4j-impl-2.8.2.jar中找到绑定!/org/slf4j/impl/StaticLoggerBinder.class]请注意,冲突来自两个罐,分别为logback-classic-1.2.3和log4j-slf4j-impl-2.8.2.jar。运行mvn dependency:tree该项目的pom.xml父文件夹,赠送:依赖树冲突现在,选择一个您要忽略的选项(可能会花费很多精力,在这方面我需要更多帮助)我决定不使用从spring-boot-starter-data-jpa(最高依赖项)通过spring-boot-starter和导入的那个spring-boot-starter-logging,pom变成:&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-starter</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; <exclusions>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <exclusion>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-starter-logging</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </exclusion>&nbsp; &nbsp; &nbsp; &nbsp; </exclusions>&nbsp; &nbsp; </dependency>&nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-starter-data-jpa</artifactId>&nbsp; &nbsp; </dependency>在以上pom spring-boot-starter-data-jpa中将使用spring-boot-starter同一文件中的配置文件,该文件不logging包含(包含logback)
打开App,查看更多内容
随时随地看视频慕课网APP