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, logfilelog4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%nlog4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.File=target/spring.loglog4j.appender.logfile.layout=org.apache.log4j.PatternLayoutlog4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
之前我按Spring MVC+MyBatis开发从入门到项目实战这本书上的写一直不对
2.在web.xml里要有这个内容
然后就可以看到控制台的日志信息了