Java教程

log4j

本文主要是介绍log4j,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

log4j

log4j.rootLogger=debug,error,stdout,DailyLog,info,warn

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[project] [%d{yyyy-MM-dd HH:mm:ss,SSS}][%-5p][%c][%t] %m\n

log4j.appender.DailyLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DailyLog.File=/tmp/project/debug.log 
log4j.appender.DailyLog.Append=true
log4j.appender.DailyLog.DatePattern='.'yyyy-MM-dd
log4j.appender.DailyLog.layout=org.apache.log4j.PatternLayout
log4j.appender.DailyLog.layout.ConversionPattern=[project] [%d{yyyy-MM-dd HH:mm:ss,SSS}][%-5p][%c][%t] %m\n

log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.layout=org.apache.log4j.PatternLayout
log4j.appender.error.layout.ConversionPattern=[project] [%d{yyyy-MM-dd HH:mm:ss,SSS}][%-5p][%c][%t] %m\n
log4j.appender.error.datePattern='.'yyyy-MM-dd
log4j.appender.error.Threshold = ERROR 
log4j.appender.error.append=true
log4j.appender.error.File=/tmp/project/error.log 

log4j.appender.info=org.apache.log4j.DailyRollingFileAppender
log4j.appender.info.layout=org.apache.log4j.PatternLayout
log4j.appender.info.layout.ConversionPattern=[project] [%d{yyyy-MM-dd HH:mm:ss,SSS}][%-5p][%c][%t] %m\n
log4j.appender.info.datePattern='.'yyyy-MM-dd
log4j.appender.info.Threshold = INFO 
log4j.appender.info.append=true
log4j.appender.info.File=/tmp/project/info.log 


log4j.appender.warn=org.apache.log4j.DailyRollingFileAppender
log4j.appender.warn.layout=org.apache.log4j.PatternLayout
log4j.appender.warn.layout.ConversionPattern=[project] [%d{yyyy-MM-dd HH:mm:ss,SSS}][%-5p][%c][%t] %m\n
log4j.appender.warn.datePattern='.'yyyy-MM-dd
log4j.appender.warn.Threshold = WARN 
log4j.appender.warn.append=true
log4j.appender.warn.File=/tmp/project/warn.log 

log4j.logger.com.taiping=debug
log4j.logger.org.hibernate=error
log4j.logger.org.springframework=error
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=error
log4j.logger.org.apache.cxf=error
log4j.logger.com.opensymphony.xwork2=error
log4j.logger.org.apache.struts2=error
log4j.logger.com.google.code=error
log4j.logger.net.bull.javamelody=error
log4j.logger.freemarker=error
log4j.logger.httpclient.wire=error
log4j.logger.org.apache.commons=error

 

这篇关于log4j的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!