45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:如何使用log4j多文件输入日志?

如何使用log4j多文件输入日志?

2016-09-02 05:17:29 来源:www.45fan.com 【

如何使用log4j多文件输入日志?

//全局默认的日志级别
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.45fan.com/a/question/71032.html
Tags: 文件 输入 LOG4J
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部