Found binding in [jar:file:/C:/Users/P0128/.m2/repository/ch/qos/logback/logback-classic/1.2

SpringBoot slf4j依赖冲突问题

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/P0128/.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:/C:/Users/P0128/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.13.3/log4j-slf4j-impl-2.13.3.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]

很显然有两个SLF4J包,一个是系统自带的一个是我新加的
新加的依赖:

       >
            >org.springframework.boot>
            >spring-boot-starter-log4j2>
            >2.3.1.RELEASE>
        >

看网上都说在

 		>
            >org.springframework.boot>
            >spring-boot-starter-web>
        >

里加入:

  			 <!--去掉springboot自带日志依赖-->
            
            
                org.springframework.boot
                spring-boot-starter-logging
            
            

可是没效果,为什么呢?因为:

	>
      >ch.qos.logback>
      >logback-classic>
      >compile>
    >

并非实在spring-boot-starter-web下引入,而是在spring-boot-starter下引入
所以只需:

    	 >
            >org.springframework.boot>
            >spring-boot-starter>
            <!--去掉springboot自带日志依赖-->
            
            
                org.springframework.boot
                spring-boot-starter-logging
            
            
        >

问题解决!

你可能感兴趣的:(SpringBoot,slf4j,log4j2,logback,log4j)