Junit报错
1 log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). 2 log4j:WARN Please initialize the log4j system properly. 3 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
解决方案:
是因为 没有对应的日志文件
对应的 将日志文件放在合适的位置即可。
下面给出一页日志文件 供参考使用:
1 ### set log levels ### 2 log4j.rootLogger = INFO , C , D , E 3 4 ### console ### 5 log4j.appender.C = org.apache.log4j.ConsoleAppender 6 log4j.appender.C.Target = System.out 7 log4j.appender.C.layout = org.apache.log4j.PatternLayout 8 log4j.appender.C.layout.ConversionPattern = [springModel][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n 9 10 ### log file ### 11 log4j.appender.D = org.apache.log4j.DailyRollingFileAppender 12 log4j.appender.D.File = ../logs/springmvc_hibernate_demo.log 13 log4j.appender.D.Append = true 14 log4j.appender.D.Threshold = INFO 15 log4j.appender.D.layout = org.apache.log4j.PatternLayout 16 log4j.appender.D.layout.ConversionPattern = [springModel][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n 17 18 ### exception ### 19 log4j.appender.E = org.apache.log4j.DailyRollingFileAppender 20 log4j.appender.E.File = ../logs/biologyInfo_error.log 21 log4j.appender.E.Append = true 22 log4j.appender.E.Threshold = ERROR 23 log4j.appender.E.layout = org.apache.log4j.PatternLayout 24 log4j.appender.E.layout.ConversionPattern =[springModel][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n