Hi There is a JIRA ticket to improve Camel so you can refer to a custom ExceptionHandler (not part of ErrroHandler per see) in the EIPs and consumers which may leverage such. However we haven't implemented that.
By default they will use the LoggingExceptionHandler which just logs the exception. Your idea of having LoggingExceptionHandler being able to adhere to the settings from the error handler is interesting, (eg. logStackTrace=false and so forth). In the short term we could possible adjust the LoggingExceptionHandler to either: - Log at DEBUG level with message + stacktrace? - Log at WARN level with just the message On Thu, Mar 10, 2011 at 11:41 PM, Mike D <[email protected]> wrote: > Hi, > > I am using Camel 2.6.0 and have a very simple file based route from a single > input dir to a single output dir, with processors connected to both routes. > In my specific use case an exception raised in a processor is not > necessarily fatal and I do not want the stack trace information to get > logged. > > The problem is even when I configure a global defaultErrorHandler and set > logStackTrace to false, when GenericFileOnCompletion catches an exception > from my processors, it uses its own internally configured > LoggingExceptionHandler as well and belches out an undesired stack trace. > > Am I simply missing a configuration step here? How can I override > GenericFileOnCompletion's automatic use of LoggingExceptionHandler or > configure it to not emit stack traces? This seems like something really > simple that I must have overlooked, however I searched the docs and mailing > lists and haven't been able to find any more clues. > > Below is my simple route which exhibits the behavior: > > > errorHandler(defaultErrorHandler().logStackTrace(false).logRetryStackTrace(false)); > > // set up a listener on the inbound file component > from("file://in").process(new Processor() { > > public void process(Exchange e) throws Exception { > System.out.println("Received IN exchange: " + e.getIn()); > } > }).to("file://out"); > > // set up a listener on the outbound file component > from("file://out").process(new Processor() { > > public void process(Exchange e) throws Exception { > System.out.println("Received OUT exchange: " + e.getIn()); > throw new Exception("Trouble!"); > } > }); > > Here is the stacktrace generated: > > [java] 2011-03-10 14:29:09,285 INFO impl.DefaultCamelContext > [main,start:1293] Apache Camel 2.6.0 (CamelContext: camel-1) is starting > [java] 2011-03-10 14:29:09,287 INFO impl.DefaultCamelContext > [main,createManagementStrategy:2239] JMX enabled. Using > ManagedManagementStrategy. > [java] 2011-03-10 14:29:09,792 INFO > converter.AnnotationTypeConverterLoader [main,load:80] Found 4 packages with > 15 @Converter classes to load > [java] 2011-03-10 14:29:09,835 INFO converter.DefaultTypeConverter > [main,loadTypeConverters:408] Loaded 150 type converters in 0.368 seconds > [java] 2011-03-10 14:29:10,085 INFO impl.DefaultCamelContext > [main,doStartOrResumeRouteConsumers:1860] Route: route1 started and > consuming from: Endpoint[file://in] > [java] 2011-03-10 14:29:10,090 INFO impl.DefaultCamelContext > [main,doStartOrResumeRouteConsumers:1860] Route: route2 started and > consuming from: Endpoint[file://out] > [java] 2011-03-10 14:29:10,090 INFO impl.DefaultCamelContext > [main,start:1310] Total 2 routes, of which 2 is started. > [java] 2011-03-10 14:29:10,091 INFO impl.DefaultCamelContext > [main,start:1311] Apache Camel 2.6.0 (CamelContext: camel-1) started in > 0.805 seconds > [java] Received IN exchange: ID-AREA-51-51907-1299796149129-0-1 > [java] Received OUT exchange: ID-AREA-51-51839-1299794138999-0-1 > [java] Received IN exchange: ID-AREA-51-51907-1299796149129-0-2 > [java] 2011-03-10 14:29:11,096 ERROR file.GenericFileOnCompletion > [Camel (camel-1) thread #1 - file://out,log:249] Caused by: > [java.lang.Exception - Trouble!] > [java] java.lang.Exception: Trouble! > [java] at > edu.isi.misd.dcmroute.DummyRoute$2.process(DummyRoute.java:54)[file:/D:/src/dcmtools/trunk/dcmroute/build/classes/:] > [java] at > org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:330)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:157)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)[camel-core-2.6.0.jar:2.6.0] > [java] at > org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)[camel-core-2.6.0.jar:2.6.0] > [java] at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_20] > [java] at > java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_20] > [java] at > java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_20] > [java] at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_20] > [java] at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)[:1.6.0_20] > [java] at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)[:1.6.0_20] > [java] at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_20] > [java] at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_20] > [java] at java.lang.Thread.run(Thread.java:619)[:1.6.0_20] > [java] 2011-03-10 14:29:11,099 WARN file.GenericFileOnCompletion > [Camel (camel-1) thread #1 - file://out,processStrategyRollback:161] > Rollback file strategy: > org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@8ab708 > for file: GenericFile[ID-AREA-51-51839-1299794138999-0-1] > [java] 2011-03-10 14:29:11,100 ERROR processor.DefaultErrorHandler > [Camel (camel-1) thread #1 - file://out,log:203] Failed delivery for > exchangeId: ID-AREA-51-51907-1299796149129-0-7. Exhausted after delivery > attempt: 1 caught: java.lang.Exception: Trouble! > > The last two log entries behave as expected based on > errorHandler(defaultErrorHandler().logStackTrace(false).logRetryStackTrace(false)) > - what I would like is that the initial ERROR from GenericFileOnCompletion > behaves the same way as well. I know it seems like a pretty minor issue, > but it would be really great for my application to not have such a large log > file generated because of a unnecessary stack trace that gets generated > every time a retry of my file processor happens. > > All that being said, this is my first time using Camel and I have to say it > is pretty awesome. > > Thanks and best regards, > Mike > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-can-I-disable-stack-traces-from-GenericFileOnCompletion-s-LoggingExceptionHandler-tp3424278p3424278.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
