缺少jar包导致的!
如果是maven项目的话添加如下内容到pom.xml文件当中:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
如果没有就直接去下!!!
接着你得配置一下log4j.properties
log4j.rootLogger=DEBUG,A1
#log4j.rootLogger=INFO,A1,R
# ConsoleAppender \u8F93\u51FA
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n
这样就好了!