ssm项目tomcat启动后报以下问题
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
解决办法:
1.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
之前我按Spring MVC+MyBatis开发从入门到项目实战这本书上的写一直不对
2.在web.xml里要有这个内容 (我配置xml,日志也能打印到控制台?!)
然后就可以看到控制台的日志信息了
转 : https://www.cnblogs.com/csdeblog/p/9528127.html