#全局設(shè)置 log4j.rootLogger=WARN, CONSOLE, LOGFILE, ERRORLOGFILE #frame包內(nèi)是公司通用框架,日志級別設(shè)為info log4j.logger.frame=info #netit包時當前項目的代碼,所以級別設(shè)成debug,方便根據(jù)日志分析 log4j.logger.netid=debug #spring的日志級別設(shè)為info log4j.logger.org.springframework=info #通用的日志輸出格式,下面的每一個日志輸出都引用它 log4j.ConversionPattern=%d [%p] %l%n%m%n%n #控制臺輸出,如果部署到正式環(huán)境中,可以注釋掉 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=${log4j.ConversionPattern} #所有日志輸出到文件,按天進行分割 log4j.appender.LOGFILE=org.apache.log4j.DailyRollingFileAppender #log4j.appender.LOGFILE.File=/app/logs/netid/log.log log4j.appender.LOGFILE.DatePattern='.'yyyy-MM-dd log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout log4j.appender.LOGFILE.layout.ConversionPattern=${log4j.ConversionPattern} #過濾warn以上級別的日志輸出到error文件,按天分割 log4j.appender.ERRORLOGFILE=org.apache.log4j.DailyRollingFileAppender log4j.appender.ERRORLOGFILE.Threshold=WARN log4j.appender.ERRORLOGFILE.File=/app/logs/netid/error.log log4j.appender.ERRORLOGFILE.DatePattern='.'yyyy-MM-dd log4j.appender.ERRORLOGFILE.layout=org.apache.log4j.PatternLayout log4j.appender.ERRORLOGFILE.layout.ConversionPattern=${log4j.ConversionPattern} #某一個關(guān)鍵業(yè)務OrderResultNotify的日志單獨輸出,按天分割 log4j.logger.netid.XXX.XXX.XXX=DEBUG,OrderResultNotify #此日志不再累加到其他日志,僅輸出在此文件中 log4j.additivity.netid.XXX.XXX.XXX=false log4j.appender.OrderResultNotify=org.apache.log4j.DailyRollingFileAppender log4j.appender.OrderResultNotify.File=/app/logs/netid/order_result_notify.log log4j.appender.OrderResultNotify.DatePattern='.'yyyy-MM-dd log4j.appender.OrderResultNotify.layout=org.apache.log4j.PatternLayout log4j.appender.OrderResultNotify.layout.ConversionPattern=${log4j.ConversionPattern} #另一個業(yè)務日志需要單獨輸出,按大小分割 log4j.logger.YYY.YYY.YYY=DEBUG,YYY log4j.appender.YYY=org.apache.log4j.RollingFileAppender log4j.appender.YYY.layout=org.apache.log4j.PatternLayout log4j.appender.YYY.layout.ConversionPattern=${log4j.ConversionPattern} #每個文件的大小 log4j.appender.YYY.MaxFileSize=1024KB #最多保留的文件個數(shù) log4j.appender.YYY.MaxBackupIndex=2 log4j.appender.YYY.File=/app/logs/netid/YYY.log |
|