log4j多文件输入日志

发表于:2007-06-22来源:作者:点击数: 标签:
//全局默认的日志级别 log4j.rootLogger=ERROR //自己要定义的日志 log4j.logger.com.woogo.golf=ERROR, A1 //配置Appender log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.File=c:/log/golf.log log4j.appender.A1.MaxFileSize

   

 //全局默认的日志级别
 log4j.rootLogger=ERROR
 //自己要定义的日志
 log4j.logger.com.woogo.golf=ERROR, A1
    
//配置Appender
log4j.appender.A1=org.apache.log4j.RollingFileAppender

log4j.appender.A1.File=c:/log/golf.log
log4j.appender.A1.MaxFileSize=500KB
log4j.appender.A1.MaxBackupIndex=50
log4j.appender.A1.Append=true
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d %r [%t] %5p [%F:%L] - %m%n

//例子:
log4j.rootLogger=INFO,stdout,rolling
log4j.logger.com.woogo.util.MailSend=INFO,A1
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %r [%t] %5p [%F:%L] - %m%n

log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.rolling.layout.ConversionPattern=%d %r [%t] %5p [%F:%L] - %m%n
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=c:\woogo.log
#log4j.appender.rolling.File=/usr/local/jakarta-tomcat-5.0.25/logs/woogo.log
log4j.appender.rolling.MaxFileSize=5120KB
log4j.appender.rolling.MaxBackupIndex=10

log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=c:\mail.log
log4j.appender.A1.MaxFileSize=500KB
log4j.appender.A1.MaxBackupIndex=50
log4j.appender.A1.Append=true
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} - [%p] [%C{1}] - %m%n

原文转自:http://www.ltesting.net