解决:maven使用logback不起作用

修正前pom文件配置如下:

     
       
            org.slf4j
            slf4j-api
            ${slf4j.version}
        
        
            org.slf4j
            jcl-over-slf4j
            ${slf4j.version}
        
        
            ch.qos.logback
            logback-classic
            ${logback.version}
        
        

       
            org.apache.activemq
            activemq-all
            5.9.0
        


观察tomcat启动日志发现如下提示:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/order_dev/apache-tomcat-7.0.29/wtpwebapps/mfy-platform/WEB-INF/lib/activemq-all-5.9.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/order_dev/apache-tomcat-7.0.29/wtpwebapps/mfy-platform/WEB-INF/lib/logback-classic-1.0.6.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 [org.slf4j.impl.Log4jLoggerFactory]


可见activemq和logback-classic的jar包均使用了SLF4J,存在冲突。

解决办法:

更改pom文件中activemq的相关配置。

修改后的pom文件如下:

      
       
            org.slf4j
            slf4j-api
            ${slf4j.version}
        
        
            org.slf4j
            jcl-over-slf4j
            ${slf4j.version}
        
        
            ch.qos.logback
            logback-classic
            ${logback.version}
        
        

        
        
            org.apache.activemq
            activemq-core
            5.7.0
        
        
            org.apache.activemq
            activemq-pool
            5.7.0
        
        




你可能感兴趣的:(maven)