LOG4J的LOG的等級(LEVEL)包含五種這 5 種等級的高低順序為 FATAL > ERROR > WARN > INFO > DEBUG
以下的PROPITES範例示範單獨LEVEL還能有不同LEVEL的集合LOG
log4j.rootLogger=debug,stdout,ROLLING_FILE,Err,MixLog
log4j.logger.MixLog =ROLLING_FILE,Err
log4j.logger.MainClass=debug,ROLLING_FILE,Err,stdout
log4j.logger.SubClassr=debug,ROLLING_FILE,Err,stdout
#console顯示
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n
#1.只SHOW ERROR==========================
log4j.appender.Err=org.apache.log4j.RollingFileAppender
log4j.appender.Err.Threshold=ERROR
log4j.appender.Err.File=D:/Error/error.log
log4j.appender.Err.Append=true
log4j.appender.Err.MaxFileSize=100MB
log4j.appender.Err.MaxBackupIndex=30
log4j.appender.Err.layout=org.apache.log4j.PatternLayout
log4j.appender.Err.layout.ConversionPattern==%d [%t] %-5p %c - %m%n
#2.只SHOW INFO=====================
log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLING_FILE.Threshold=INFO
log4j.appender.ROLLING_FILE.File=D:/Info/rolling.log
log4j.appender.ROLLING_FILE.Append=true
log4j.appender.ROLLING_FILE.MaxFileSize=100MB
log4j.appender.ROLLING_FILE.MaxBackupIndex=30
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLING_FILE.layout.ConversionPattern==%d [%t] %-5p %c - %m%n
#3.SHOW INFO+ERROR=====================
log4j.appender.MixLog=org.apache.log4j.RollingFileAppender
log4j.appender.MixLog.Threshold=INFO
log4j.appender.MixLog.File=D:/MIX/rolling.log
log4j.appender.MixLog.Append=true
log4j.appender.MixLog.MaxFileSize=100MB
log4j.appender.MixLog.MaxBackupIndex=30
log4j.appender.MixLog.layout=org.apache.log4j.PatternLayout
log4j.appender.MixLog.layout.ConversionPattern==%d [%t] %-5p %c - %m%n
Great write-up, Hiring local app developers poses a great advantage over the process of outsourcing. When you hire app makers near me you will surely get a better result. On Eiliana.com which is a global freelancing portal, you can filter and hire the freelancers as per the location.
回覆刪除