问答详情
源自:-

Failed to load class "org.slf4j.impl.StaticLoggerBinder".

Failed to load class "org.slf4j.impl.StaticLoggerBinder".

提问者:闪电小子James 2017-06-29 13:11

个回答

  • 翔仔
    2017-06-29 23:10:14

    同学,单从这个错误的话没办法去帮你找到问题,你看看是不是pom.xml少配了些什么,可以参照源码,应该是slf4j-log4j12-XX.jar包缺失导致

  • bloodyknife
    2017-07-12 17:07:07

    解决方法:

    步骤一:pom.xml加入jar包

    <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.17</version>
    </dependency>
    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <version>1.7.7</version>
    </dependency>

    步骤二:在类路径下添加log4j.properties文件,并加入如下内容:

    log4j.rootLogger=WARN, stdout
    # log4j.rootLogger=WARN, stdout, logfile

    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

    log4j.appender.logfile=org.apache.log4j.FileAppender
    log4j.appender.logfile.File=target/spring.log
    log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
    log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n