码迷,mamicode.com
首页 > 移动开发 > 详细

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)的解决

时间:2018-03-17 16:09:35      阅读:1363      评论:0      收藏:0      [点我收藏+]

标签:pat   ring   res   org   pac   stdout   报错   frame   work   

报错:log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).

出错原因:缺少日志文件,主要是后面的原因org.springframework.core.env.StandardEnvironment

解决方案:在resource中添加对应的log4j.properties文件,文件内容为

log4j.rootLogger=DEBUG,A1
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} [%t] [%c]-[%p] %m%n

或者
# Configure logging for testing: optionally with log file
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

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)的解决

标签:pat   ring   res   org   pac   stdout   报错   frame   work   

原文地址:https://www.cnblogs.com/codething/p/8590042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!