log4j多文件输入日志

类别:Java 点击:0 评论:0 推荐:

 //全局默认的日志级别
 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://com.8s8s.com/it/it13331.htm