在做log4j的日志中,发现访问每个action的时候,日志都会有警告提示输出到控制台,导致查询相关信息非常麻烦,提示如下:
WARN ][2014-04-19 08:19:44] com.opensymphony.xwork2.ognl.OgnlValueStack - Could not find property [struts.actionMapping]com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn(CommonsLogger.java:45)
[WARN ][2014-04-19 08:19:44] com.opensymphony.xwork2.ognl.OgnlValueStack - Could not find property [org.apache.catalina.jsp_file]com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn(CommonsLogger.java:45)
[WARN ][2014-04-19 08:19:44] com.opensymphony.xwork2.ognl.OgnlValueStack - Could not find property [struts.actionMapping]com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn(CommonsLogger.java:45)
[WARN ][2014-04-19 08:19:44] com.opensymphony.xwork2.ognl.OgnlValueStack - Could not find property [struts.actionMapping]com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn(CommonsLogger.java:45)
log4j.properties的配置如下:
log4j.rootLogger=info,stdout,info,error
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%-5p][%d{yyyy-MM-dd HH:mm:ss}]%m - %l%n
log4j.logger.com.lbs.leaf.sysmanage.webcontroller.SafetyFilter= info
log4j.logger.com.ibatis=debug
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=debug
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=debug
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debug
log4j.logger.java.sql.Connection=debug
log4j.logger.java.sql.Statement=debug
log4j.logger.java.sql.PreparedStatement=debug
#log4j.logger.org.apache=WARN
log4j.logger.info=info
log4j.appender.info=org.apache.log4j.DailyRollingFileAppender
log4j.appender.info.layout=org.apache.log4j.PatternLayout
log4j.appender.info.layout.ConversionPattern=[%-5p][%d{yyyy-MM-dd HH:mm:ss}]%m - %l%n
log4j.appender.info.datePattern='.'yyyy-MM-dd
log4j.appender.info.Threshold=INFO
log4j.appender.info.append=true
log4j.appender.info.File=${GoodsMS}/WEB-INF/logs/info.log
log4j.logger.debug=debug
log4j.appender.debug=org.apache.log4j.DailyRollingFileAppender
log4j.appender.debug.layout=org.apache.log4j.PatternLayout
log4j.appender.debug.layout.ConversionPattern=[%-5p][%d{yyyy-MM-dd HH:mm:ss}] %c - %m%n
log4j.appender.debug.datePattern='.'yyyy-MM-dd
log4j.appender.debug.Threshold=DEBUG
log4j.appender.debug.append=true
log4j.appender.debug.File=${GoodsMS}/WEB-INF/logs/debug.log
log4j.logger.com.opensymphony.xwork2=ERROR
log4j.logger.error=error
log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.layout=org.apache.log4j.PatternLayout
log4j.appender.error.layout.ConversionPattern=[%-5p][%d{yyyy-MM-dd HH:mm:ss}] %c - %m%l%n
log4j.appender.error.datePattern='.'yyyy-MM-dd
log4j.appender.error.Threshold=ERROR
log4j.appender.error.append=true
log4j.appender.error.File=${GoodsMS}/WEB-INF/logs/error.log
log4j.logger.warn=warn
log4j.appender.warn=org.apache.log4j.DailyRollingFileAppender
log4j.appender.warn.layout=org.apache.log4j.PatternLayout
log4j.appender.warn.layout.ConversionPattern=[%-5p][%d{yyyy-MM-dd HH:mm:ss}] %c - %m%n
log4j.appender.warn.datePattern='.'yyyy-MM-dd
log4j.appender.warn.Threshold=WARN
log4j.appender.warn.append=true
log4j.appender.warn.File=${GoodsMS}/WEB-INF/logs/warn.log
解决警告的措施,在配置文件中加入以下的代码,就不会有警告提示
log4j.logger.com.opensymphony.xwork2=ERROR