zoukankan      html  css  js  c++  java
  • SpringCloud项目里slf4j依赖冲突问题解决

    项目启动的时候会报SLF4J: Class path contains multiple SLF4J bindings.

    SLF4J: Found binding in [jar:file:.../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:.../org/apache/logging/log4j/log4j-slf4j-impl/1.7.25/log4j-slf4j-impl-2.11.2.jar!/org/slf4j

    /impl/StaticLoggerBinder.class]

    网上搜了下,都是如下这种:

    1、“SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/D:/maven-3.3.3/m2/repository/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:/maven-3.3.3/m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org

    /slf4j/impl/StaticLoggerBinder.class]”

    2、“

    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/G:/repo/repo-mvn-qingmu/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:/G:/repo/repo-mvn-qingmu/org/slf4j/slf4j-log4j12/1.7.30
    /slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]”

    大致可以看到都是
    slf4j-log4j12-xxx.jar这种多出来的依赖,而我这个是log4j-slf4j-impl-2.11.2.jar,还是不一样的,因为我要用logback,
    所以要解决的肯定时log4j-slf4j-impl-2.11.2.jar依赖。

    解决过程:
    排查每个Module的依赖,idea里有工具可以看的,然后找到log4j-slf4j-impl-2.11.2.jar,看谁依赖了它,然后在其下加入:
    <exclusions>
                <exclusion>
                    <groupId>org.apache.log4j</groupId>
                    <artifactId>log4j-slf4j-impl</artifactId>
                </exclusion>
            </exclusions>
  • 相关阅读:
    ubuntu 16.04 网络配置之虚拟网卡的配置
    rabbitmq集群节点操作
    Ubuntu system zabbix-server-3.x install documentation
    PS RSS
    proxy_set_header设置Host为$proxy_host,$host与$local_host的区别
    centos 7 free 字段含义
    Linux atop 监控系统状态
    谨慎调整内核参数:vm.min_free_kbytes
    nginx反向代理http与https两种协议配置简述
    Python 获取以毫秒为单位的时间戳
  • 原文地址:https://www.cnblogs.com/emmalai/p/13450901.html
Copyright © 2011-2022 走看看