当前位置: 首页 > 工具软件 > Gmail4J > 使用案例 >

log4j错误通过gmail发送

卓星波
2023-12-01

添加GmailSMTPAppender.java

 

 

log4j.properties添加

log4j.rootLogger=INFO,console,EMAIL

 

log4j.logger.com.tgerm=EMAIL

log4j.additivity.com.tgerm=false

 

 

 

log4j.appender.EMAIL=com.tgerm.log4j.appender.GmailSMTPAppender

log4j.appender.EMAIL.SMTPHost=smtp.gmail.com

log4j.appender.EMAIL.SMTPDebug=false

log4j.appender.EMAIL.From=no-reply@gmail.com

log4j.appender.EMAIL.To=zhizhong.lu@gmail.com

log4j.appender.EMAIL.SMTPUsername=no-reply@gmail.com

log4j.appender.EMAIL.SMTPPassword=password

log4j.appender.EMAIL.Subject=Error Message

#log4j.appender.EMAIL.cc=cc@gmail.com

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

log4j.appender.EMAIL.layout.ConversionPattern=[%d] [%t] [%-5p] [%c] - %m%n

log4j.appender.EMAIL.BufferSize=1

 

 类似资料: