开发者社区 问答 正文

log4.properties配置发送错误日志?报错

log4.properties发送邮件  报错  Could not connect to SMTP host: smtp.163.com, port: 465, response: -1    配置如下:

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


#log4j.appender.MAIL.Threshold=DEBUG
log4j.appender.MAIL.Threshold=ERROR

log4j.appender.MAIL.SendMailInterval=60
log4j.appender.MAIL.SMTPPort=465
log4j.appender.MAIL.SMTPHost=smtp.163.com

log4j.appender.MAIL.Subject=app Error log

log4j.appender.MAIL.SMTPUsername=1xxx775@163.com

log4j.appender.MAIL.SMTPPassword=xxxxx

log4j.appender.MAIL.From=xxxxx@163.com

log4j.appender.MAIL.To=xxxxx@qq.com,xxxxxx@qq.com

log4j.appender.MAIL.SMTPDebug=false

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

log4j.appender.MAIL.layout.ConversionPattern=%d{yyyy-MM-dd HH🇲🇲ss} [%p] [%t] %l:%m%n

展开
收起
爱吃鱼的程序员 2020-06-08 09:54:34 588 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    163,qq之类的免费邮箱,都限制代码发送邮件。换一个邮箱

    2020-06-08 09:54:47
    赞同 展开评论