Why not just letting the deadLetterChannelhandler send the exchange into a mail endpoint like this ?

errorHandler(deadLetterChannel("smtp://[usern...@]host[:port][?options]") .useOriginalMessage().mamimumRedeliveries(5).redeliverDelay(5000);

On 10/19/10 9:01 PM, Andreas A. wrote:

Hi

I'm trying to create a log4j setup that sends an e-mail on most
ERROR-messages that my application emits - primarily on exceptions. However
it's difficult not to get flooded with e-mails since log4j outputs several
ERROR-messages per exception like so:

2010-10-19 14:49:27,457 ERROR [Camel Thread 0 - file://data/in]
[org.apache.camel.processor.DefaultErrorHandler]: Failed delivery for
exchangeId: 1acc97f0-aefd-4c77-9ee1-10f0ae69af4b. Exhausted after delivery
attempt: 1 caught: java.lang.Exception
java.lang.Exception
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at .....

2010-10-19 14:49:29,692 ERROR [Camel Thread 0 - file://data/in]
[org.apache.camel.component.file.GenericFileOnCompletion]: Caused by:
[java.lang.Exception - null]
java.lang.Exception
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at .....

I have an appender like this:

<appender name="mail" class="dk.mytest.SMTPSSLAppender">
        
        
        
        
        
        
        
        
        <layout class="org.apache.log4j.HTMLLayout" />
        <!-- Do not e-mail about this exception -->
        <filter class="org.apache.log4j.varia.StringMatchFilter">
                
                
        </filter>
</appender>

Any ideas how to improve this either with Camel or log4j configuration?


--
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang

Reply via email to