我的log4j文件生成两个记录器文件,一个用于errors
,一个用于information
。我想得到一个
仅在发生error
时才发送电子邮件。我们该如何分隔电子邮件?
log4j.rootLogger=INFO,file
#for ERROR level logs
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.File=
...
log4j.appender.userfile=org.apache.log4j.RollingFileAppender
log4j.appender.userfile.File=
...
log4j.appender.email=org.apache.log4j.net.SMTPAppender #How do we configure here for only getting email for error logs?
log4j.category.eLogger=ERROR, file
log4j.additivity.eLogger=false
log4j.category.uLogger=INFO, userfile
log4j.additivity.uLogger=false
我的log4j版本是1.2