2

I have been through lot of WildFly documentation in past day and so far I have failed to understand how a SMTP Handler could be added to WildFly logging sybsystem. This was very easy when JBoss used log4j but now there are hardly any documentation available.

Places I have already looked at: https://docs.jboss.org/author/display/WFLY8/Logging+Configuration

There is support of using a Custom Log handler. as mentioned jira https://issues.jboss.org/browse/AS7-1438 but are there any examples available? can log4j SMTP handler be used here?

Is this the best solution available? https://developer.jboss.org/wiki/CreatingACustomLoggingHandlerInJBOSSAs710Final

4

1 回答 1

4

这个用 jboss-cli 怎么样:

/subsystem=logging/custom-handler=LOG4J_SMTP:add( \
 class="org.apache.log4j.net.SMTPAppender", \
 module="org.apache.log4j", \
 formatter="%-5p [%c] (%t) %s%e", \
 level=INFO, \
 properties={ \
  From="jane.doe@gmail.example.com", \
  LocationInfo=true, \
  SMTPDebug=true, \
  SMTPHost="smtp.gmail.com", \
  SMTPPort=465, \
  SMTPProtocol="smtps", \
  SMTPUsername="jane.doe@gmail.example.com",  \
  SMTPPassword="***", \
  Subject="error mail subject", \
  To="jane.doe@icloud.example.com", \
  BufferSize=256 })

有关配置详细信息,请参阅: http: //logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SMTPAppender.html

于 2015-03-07T12:15:03.893 回答