Log4j SMTPappender 与 HTML 邮件
我想使用 log4j 并以 HTML 格式发送电子邮件(使用 SMTP Appender)。 log4j 中是否可以开箱即用。
如果是这样,请指出正确的例子
I would like to use log4j and send email in HTML format (Using SMTP Appender). Is it possible in log4j out of the box.
If so please point me to right examples
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Logback 提供了将日志格式化为 HTML 的布局。将其与 SMTPAppender 结合起来将以 HTML 格式发送电子邮件。
http://logback.qos.ch/manual/layouts.html#ClassicHTMLLayout
直接引用页面:
您甚至可以轻松获取源代码并对其进行修改,以满足您的需求。
http://logback.qos.ch/xref/ ch/qos/logback/classic/html/HTMLLayout.html
They provide the following code to initilaize the appender:
I hope that helps in some way,
-g男性
Logback provides a Layout that formats the logs as HTML. Combining that with an SMTPAppender would send email in HTML format.
http://logback.qos.ch/manual/layouts.html#ClassicHTMLLayout
Direct quote from the page:
You could even take the source code and modify it, pretty easily, to suit your needs.
http://logback.qos.ch/xref/ch/qos/logback/classic/html/HTMLLayout.html
They provide the following code to initilaize the appender:
I hope that helps in some way,
-gMale