log4j:WARN No appenders could be found for logger 报错解决办法

log4j:WARN No appenders could be found for logger 报错解决办法
强烈推介IDEA2020.2破解激活,IntelliJ IDEA 注册码,2020.2 IDEA 激活码

问题描述:

项目启动失败,控制台打印错误提示信息:

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

原因:

缺少log4j日志配置文件log4j.properties

解决办法:

在项目resources目录下添加配置文件log4j.properties,粘贴内容如下:

# Global logging configuration 开发时候建议使用 debug
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
本文来源KeiKei.,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/25341

发表评论