log4j.properties的配置

### set log levels ###
#log4j.rootLogger = debug, stdout, D, E
log4j.rootLogger = stdout, D, E
### out to kong zhi tai ###
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:%L - %m%n
### out to ri zhi wen jian all ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
##
#log4j.appender.D.File =/home/webgate/web/runs/logs/hjck_log.log
log4j.appender.D.File = E://logs/fapayg_log.log
log4j.appender.D.DatePattern='_'yyyy-MM-dd'.log'
log4j.appender.D.Append = true
## out DEBUG ji bie yi shang wen jian
log4j.appender.D.Threshold = DEBUG
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [%t:%r] - [%p] %m%n
log4j.appender.D.encoding=GBK

### bao cun yi chang dao dan du wen jian  error ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.DatePattern='_'yyyy-MM-dd'.log'
## yi chang wen jian ming
##
log4j.appender.E.File = E://logs/fapayg_error.log

## out ERROR ji bie yi shang wen jian !!!
log4j.appender.E.Append = true
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [%t:%r] - [%p] %m%n
log4j.appender.E.encoding=GBK

log4j.logger.java.sql.Connection = debug 
log4j.logger.java.sql.Statement = info 
log4j.logger.java.sql.PreparedStatement = debug, fileout  
有兴趣的可以加Q群:203609918,我们一起进步!!!

你可能感兴趣的:(log4j)