<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
I reported an error with 2.0. Just reduce the version
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
I reported an error with 2.0. Just reduce the version
Public java reward, like control
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
solution:
Add by
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
Add log configuration file log4j.properties
#Modify log levels as needed
log4j.rootLogger=INFO, stdout, logfile
log4j.debug=true
log4j.additivity.org.apache=true
#Console output
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
#Catalina
# Define all the appenders
log4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.Append=true
log4j.appender.CATALINA.Encoding=UTF-8
# Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd-HH'.log'
log4j.appender.CATALINA.MAXFileSize = 20MB
log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
log4j.appender.CATALINA.layout.ConversionPattern =%d{HH:mm:ss} %5p [%t] - %m%n
#files output
#log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=/logs/spider.log
log4j.appender.logfile.DatePattern='.'yyyy-MM-dd-HH'.log'
#Log file maximum 20M
log4j.appender.logfile.MaxFileSize=20MB
log4j.appender.logfile.MaxBackupIndex=5
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
#logger
log4j.logger.org.springframework=DEBUG
log4j.logger.com.xxx=DEBUG
#log4j.logger.org.apache=DEBUG
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
#spring aop intercept method, calculate the time spent on method execution
log4j.additivity.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=false
log4j.logger.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=TRACE
httpclient.wire.header=ERROR
httpclient.wire.content=ERROR
org.apache.commons.httpclient = ERROR
httpclient.wire = ERROR