电子邮件日志文件,由 Java WebLogic 应用程序服务器生成

发布于 2024-07-23 07:17:12 字数 92 浏览 1 评论 0原文

这个要求符合J2EE标准吗? 有没有一种简单的方法来实现这一点,日志文件由 Log4J 生成,最后我将访问文件系统并通过电子邮件发送整个文件。 我可以访问文件系统吗?

does this requirement conform to the J2EE Standards?
is there a easy way to implement this, log file gets generated by Log4J and in the end I will access the file system and email the whole file(s). can I access the file system?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心是晴朗的。 2024-07-30 07:17:12

Log4j 有一个电子邮件附加程序...

请参阅:http://www.onjava.com/pub/a/onjava/2004/09/29/smtp-logging.html?page=2
(另请参阅第 1 页)

Log4j has an email appender...

See: http://www.onjava.com/pub/a/onjava/2004/09/29/smtp-logging.html?page=2
(Also look on page 1)

生生漫 2024-07-30 07:17:12

使用 log4j,您可以将电子邮件附加程序添加到您的配置中。 您可以在 log4j.proeprties 中声明附加程序:

log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.To= #recepient 的电子邮件地址
log4j.appender.email.From= #发件人的电子邮件地址
log4j.appender.email.SMTPHost= #您的 smtp 服务器的位置
log4j.appender.email.Threshold=FATAL #生成电子邮件的最低日志级别
log4j.appender.email.BufferSize=512
log4j.appender.email.Subject= #发出的电子邮件的主题行
log4j.appender.email.layout=org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern=-[%d] %-4L %-5p %c %x - %m%n #message format

需要记住的事情:此附加程序将在满足以下条件的每条日志消息上发送一封电子邮件阈值要求,因此建议设置较高的阈值,这样您的收件箱就不会被不重要的消息淹没。

with log4j, you can add an email appender to your configuration. You can declare the appender in your log4j.proeprties so:

log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.To= #recepient's email address
log4j.appender.email.From= #the sender's email address
log4j.appender.email.SMTPHost= #location of your smtp server
log4j.appender.email.Threshold=FATAL #the lowest log level on which the email is generated
log4j.appender.email.BufferSize=512
log4j.appender.email.Subject= #subject line of the email sent out
log4j.appender.email.layout=org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern=-[%d] %-4L %-5p %c %x - %m%n #message format

Something to remember: this appender will send an email on every log message that meets the threshold requirement so having a high threshold is recommended so your inbox doesn't get flooded with messages that are non critical.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文