kangjianrong

log4j生成配置

#控制台
#打印控制台日志
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#输出HQL及参数到控制台
#log4j.appender.CONSOLE.Threshold=trace
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.Encoding=UTF-8
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p [%c.%M] - %m%n
#打印INFO级别及以上的日志
#每天生成1个日志文件
log4j.appender.PRODUCT=org.apache.log4j.DailyRollingFileAppender
log4j.appender.PRODUCT.Append=true
log4j.appender.PRODUCT.DatePattern='.' 
log4j.appender.PRODUCT.File=irs.log
log4j.appender.PRODUCT.Threshold=INFO
log4j.appender.PRODUCT.Encoding=UTF-8
#log4j.appender.PRODUCT.MaxFileSize=20MB
log4j.appender.PRODUCT.layout=org.apache.log4j.PatternLayout
log4j.appender.PRODUCT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p [%c.%M] - %m%n
#打印ERROR级别的日志
#每天生成1个日志文件
log4j.appender.PRODUCT-ERROR=org.apache.log4j.DailyRollingFileAppender
log4j.appender.PRODUCT-ERROR.Append=true
log4j.appender.PRODUCT-ERROR.DatePattern='.' 
log4j.appender.PRODUCT-ERROR.File=irs-error.log
log4j.appender.PRODUCT-ERROR.Threshold=ERROR
log4j.appender.PRODUCT-ERROR.Encoding=UTF-8
log4j.appender.PRODUCT-ERROR.layout=org.apache.log4j.PatternLayout
log4j.appender.PRODUCT-ERROR.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p [%c.%M] - %m%n

log4j.logger.org.hibernate=INFO
log4j.logger.org.hibernate.SQL=trace
log4j.logger.org.hibernate.HQL=trace
log4j.category.org.hibernate.type=trace
log4j.logger.org.springframework=INFO
log4j.rootLogger=INFO,  

| Back |