ERROR Could not find value for key log4j.appender.Console

log4j报错:

log4j:ERROR Could not find value for key log4j.appender.Console 
log4j:ERROR Could not instantiate appender named “Console”. 
log4j:WARN No appenders could be found for logger (org.directwebremoting.util.Logger). 
log4j:WARN Please initialize the log4j system properly.

 

 

配置中这么写:

log4j.rootLogger = DEBUG,Console

应该增加:Console

log4j.appender.Console= org.apache.log4j.DailyRollingFileAppender 
log4j.appender.Console.File = /home/htmlfile/logs/ms.log 
log4j.appender.Console.Append = true 
log4j.appender.Console.DatePattern = ‘.’yyyy-MM-dd 
log4j.appender.Console.layout = org.apache.log4j.PatternLayout 
log4j.appender.Console.layout.ConversionPattern = %d %-5p – [%l] – %m%n

主要是没有在配置文件中定义造成初始化错误!

本文转自jooben 51CTO博客,原文链接:http://blog.51cto.com/jooben/357066

点赞