log4j:WARN No appenders could be found for logger错误

Posted 帝国攻城狮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了log4j:WARN No appenders could be found for logger错误相关的知识,希望对你有一定的参考价值。

用Hibernate连上数据库之后不能插入数据,报了这个错误。

直接写我的解决办法:
src下面新建file名为log4j.properties内容如下:

# 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错误的主要内容,如果未能解决你的问题,请参考以下文章

log4j:WARN No appenders 警告

解决log4j:WARN No appenders could be found for logger

log4j:WARN No appenders could be found for logger错误

log4j:WARN No appenders could be found for logger

关于控制台输出 警告 log4j:WARN No appenders could be found for logger

log4j:WARN No appenders could be found for logger