I saw a pretty old thread where a user asked for advice using the smtp-appender that sends mails when errors are logged in the JBoss-server. He didn't get a solution so I try again:
I see that JBoss default has a default appender that is commented out. This is just what I need, I want an email each time an error occurs in the server. I have dropped to paste in the appender since this forum doesn't handle the html-tags. :)
But I'm a bit afraid. What will happen if something really serious happens, ie that something loops and starts to fail all the time? Will this fill up the mailbox or may be take down the whole mail system?
What I really want is a safety net that avoids sending more that one mail each N minute, or maybe a filter that skips already posted messages.
Is there an easy way to get this or do I have to write something myself?
Thanks for tips :)
Write a Log4j filter that filter's messages (based on logger name maybe?) when they occur within a given frequency. See http://logging.apache.org/log4j/docs/api/org/apache/log4j/spi/Filter.html in order to get started. Then, you will need to configure your SMTPAppender so that this filter is used in the log4j.xml file.