Hi

You can configure the error handler to not log at ERROR level when its
exhausted.
There is a log level for that you can set.

However then you may risk the caller/consumer not logging it at all.
Although I think we have fixed most of this in the most often used
camel components. But if you use a custom component or some other
camel component it may not log exceptions when the route complete
(even if it failed).

Instead you can use the EventNotifier and let it send the email or log
at ERROR level
http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html

Just listen for ExchangeFailedEvent or something like that.


On Tue, Oct 19, 2010 at 3:01 PM, Andreas A. <andreasasm...@gmail.com> 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?
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Limit-ERROR-emits-for-logging-tp3218995p3218995.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to