开发者

How to use/activate the log4j SMTPAppender in JBoss 7 Final

开发者 https://www.devze.com 2023-03-23 06:48 出处:网络
I asked this in the jboss forum already but didn\'t get an answer yet: http://community.jboss.org/message/615861

I asked this in the jboss forum already but didn't get an answer yet: http://community.jboss.org/message/615861

In JBoss 7.0.0 Final how do I get the SMTPAppender from log4j working?

In standalone/configuration/logging.properties I added the following:

# SMTP
handler.SMTP=org.apache.log4j.net.SMTPAppender
handler.SMTP.level=${jboss.boot.server.log.console.level:WARN}
handler.SMTP.formatter=PATTERN
handler.SMTP.autoFlush=true
handler.SMTP.SMTPHost=smtp.mycompany.com
handler.SMTP.to=me@mycompany.com
handler.SMTP.subject=Testing the appender
handler.SMTP.开发者_Python百科from=my@mycompany
handler.SMTP.layout=org.apache.handler.SimpleLayout
..

With this starting jboss prints the following:

Failed to configure handler SMTP on Logger '' in context org.jboss.logmanager.LogContext@1549f94: Handler SMTP could not be instantiated
10:50:29,118 INFO  [org.jboss.modules] JBoss Modules version 1.0.1.GA
10:50:29,743 INFO  [org.jboss.msc] JBoss MSC version 1.0.0.GA
10:50:29,836 INFO  [org.jboss.as] JBoss AS 7.0.0.Final "Lightning" starting
...

As mentioned in the forum I couldn't find any documentation but this.

Any ideas how to get this working? Thanks Riggs


I think you just cant use Log4J Handlers with JBoss. JBoss AS7 seems to use java.util.logging.Handler where you need to derive your own handlers from.

0

精彩评论

暂无评论...
验证码 换一张
取 消