【问题标题】:Sending email on error occurance in Spring Boot在 Spring Boot 中发生错误时发送电子邮件
【发布时间】:2019-12-26 14:08:02
【问题描述】:

我想在发生错误时以电子邮件的形式发送错误消息。

我知道可以使用 log4j 的配置文件。我想使用 log4j 发送邮件,使用属性文件而不是 xml 文件来设置属性。

【问题讨论】:

    标签: spring-boot email logging log4j


    【解决方案1】:

    您需要使用 SMTPAppender 使用 log4j 发送电子邮件。在此页面上查看属性列表:

    https://logging.apache.org/log4j/2.x/manual/appenders.html

    以下问题对如何使用log4j SMTPAppender有完整的解决方案。

    Using log4j to send email reports via the SMTPAppender

    【讨论】:

      猜你喜欢
      • 2015-04-16
      • 2021-06-30
      • 2021-08-10
      • 1970-01-01
      • 1970-01-01
      • 2011-04-12
      • 1970-01-01
      • 1970-01-01
      • 2017-10-15
      相关资源
      最近更新 更多