请教:怎么利用log4j将log通过email发出?

04-04-09 sunny.wu
为什么总是收不到邮件???

我的系统:log4j1.2.8, Jboss为jboss-3.0.6_tomcat-4.1.18。

在log4j.properties文件中配置如下:

log4j.logger.MailLog=WARN,EMAIL

### The EMAIL appender

log4j.appender.EMAIL=org.apache.log4j.net.SMTPAppender

log4j.appender.EMAIL.BufferSize=512

log4j.appender.EMAIL.From=sender@xxx.xxx

log4j.appender.EMAIL.SMTPHost=smtp.xxx.xxx

log4j.appender.EMAIL.Subject=Jboss Error Report

log4j.appender.EMAIL.To=receive@xxx.xxx

log4j.appender.EMAIL.layout=org.apache.log4j.PatternLayout

log4j.appender.EMAIL.layout.conversionPattern=%d %-5p [%-10t] %c{2} - %m%n

猜你喜欢