log4j:WARN No appenders could be found for logger

Eclipse 用Spring导入log4j:WARN No appenders could be found for logger这几个文件都正常,可是写简单的代码输出HelloWorld,运行就出现下面的错误:
log4j:WARN No appenders could be found for logger
解决这问题是在src下新建log4j.properties文件
log4j:WARN No appenders could be found for logger
在这文件写入下面代码:
log4j.rootLogger=DEBUG, CONSOLE

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %10l - %m%n

##log4j.appender.FILE=org.apache.log4j.RollingFileAppender
##log4j.appender.FILE.File=E:/logs/log4j.log
##log4j.appender.FILE.MaxFileSize=1MB
##log4j.appender.FILE.Append = true
##log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
##log4j.appender.FILE.layout.ConversionPattern=%d{yyyy/MM/dd/HH:mm:ss} %-5p [%t] %10l - %m%n

log4j:WARN No appenders could be found for logger
这样就OK了。

log4j:WARN No appenders could be found for logger

上一篇:Cisco路由器上传和下载IOS


下一篇:Flutter,webview里面实现上传和下载的功能