码迷,mamicode.com
首页 > 其他好文 > 详细

log4j 配置实例

时间:2015-03-31 10:27:58      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

1. http://hehongwei44.iteye.com/blog/1494999

2. http://maymay.iteye.com/blog/1275432

 

#log4j.rootLogger = [ level ] , appenderName, appenderName, ...
log4j.rootLogger = info,console, R
#level=INFO,all can be output
#console is set to be a ConsoleAppender
log4j.appender.console = org.apache.log4j.ConsoleAppender
#console have four patterns
#org.apache.log4j.HTMLLayout
#org.apache.log4j.PatternLayout
#org.apache.log4j.SimpleLayout
#org.apache.log4j.TTCCLayout
log4j.appender.console.layout = org.apache.log4j.PatternLayout
#define the output type
log4j.appender.console.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] %m%n
#file is set to output to a extra file
log4j.appender.R = org.apache.log4j.RollingFileAppender
#the absolute route of the log4j file
log4j.appender.R.File =${catalina.home}/logs/lego.log
#the size
log4j.appender.R.MaxFileSize = 500KB
#back up a file
log4j.appender.R.MaxBackupIndex = 1
log4j.appender.R.layout = org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [%c]-[%p] - %m%n

log4j.logger.com.sc.ops.be.lego.service = info,legoService
log4j.appender.legoService = org.apache.log4j.DailyRollingFileAppender
log4j.appender.legoService.File =${catalina.home}/logs/lego_build.log
log4j.appender.legoService.layout = org.apache.log4j.PatternLayout
log4j.appender.legoService.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss.SSS} [%p] - %m%n

log4j 配置实例

标签:

原文地址:http://www.cnblogs.com/hello-yz/p/4380062.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!