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

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

出错原因:缺少日志文件

解决方案:

在下图位置添加一个日志文件,

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)_第1张图片


文件内容为:

# 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

==============================我是更新线===============================

有的朋友发现改了没用,可能是路径的问题,上面把日志文件放在了config文件夹里,
是因为我配置了这个deployment assembly。
右键项目-属性-deployment assembly
log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)_第2张图片

如果这里配置了的话,上面的路径就没问题,如果没配置,编译后的日志文件可能就不在正确的路径下,可以在这个位置放日志文件
log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)_第3张图片
如果还是不正确,那我暂时就不知道怎么办啦~~~

再踩我我生气啦!!!!!!!!!









你可能感兴趣的:(常见错误总结)