Failed to load class

网友投稿 623 2022-11-27

Failed to load class

Failed to load class

普通java项目报错,控制台如下

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-operation (NOP) logger implementationSLF4J: See for further details.

解决方法

添加maven依赖

log4j log4j 1.2.17 org.slf4j slf4j-log4j12 1.6.6

添加日志配置文件 log4j.properties

#根据需要修改日志级别log4j.rootLogger=INFO, stdout, logfilelog4j.debug=truelog4j.additivity.org.apache=true#控制台输出log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n#Catalina日志# Define all the appenderslog4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.CATALINA.Append=true log4j.appender.CATALINA.Encoding=UTF-8 # Roll-over the log once per daylog4j.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 #文件输出#log4j.appender.logfile=org.apache.log4j.RollingFileAppenderlog4j.appender.logfile=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.logfile.File=/logs/spider.log log4j.appender.logfile.DatePattern='.'yyyy-MM-dd-HH'.log'#日志文件最大20Mlog4j.appender.logfile.MaxFileSize=20MBlog4j.appender.logfile.MaxBackupIndex=5log4j.appender.logfile.layout=org.apache.log4j.PatternLayoutlog4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n#loggerlog4j.logger.org.springframework=DEBUGlog4j.logger.com.xxx=DEBUG#log4j.logger.org.apache=DEBUGlog4j.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=DEBUGlog4j.logger.java.sql.ResultSet=DEBUG#spring aop拦截方法,计算方法执行所耗时间log4j.additivity.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=falselog4j.logger.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=TRACE= ERROR= ERROR

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:springmvc @RequestBody String类型参数的使用
下一篇:升级chrome浏览器导致网站登录功能不能用
相关文章

 发表评论

暂时没有评论,来抢沙发吧~