We use jBoss logging and got it finally working – now we have the problem that we dont want to send an e-Mail everytime an ERROR accures. We just want to send an e-Mail if defined Exceptions are thrown. e.g. com.myproject.exceptions.fatal.ProjectFatalException
The default definition in the “jboss-logging.xml” looks like this:
<log4j-appender name="SMTP" class="org.apache.log4j.net.SMTPAppender">
<error-manager>
<only-once/>
</error-manager>
<level name="ERROR"/>
<properties>
<property name="to">admin@myhost.domain.com</property>
<property name="from">nobody@myhost.domain.com</property>
<property name="subject">JBoss Sever Errors</property>
<property name="SMTPHost">localhost</property>
<property name="bufferSize">10</property>
</properties>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] (%t) %m%n"/>
</formatter>
</log4j-appender>
Although this answer is almost 3 months late, hopefully this still helps you and others in the future. You can use the
StringMatchFilterto limit the email to a certain error.You can solve this problem with a combination of SMTPAppender and filters. Add the following in your
jboss-log4j.xml:-As a side note, generally it is a good idea to add slow appenders like SMTP as ASYNC. By default it is synchronous.