Hello everyone,

I'm using the Camel File component to monitor a directory for any file
written there and upload them to a server. Once a file is uploaded, it is
moved to a different directory. If the upload attempt fails, the file is
left in place and another attempt is made to upload it in the next poll
cycle of the File component. The code looks like this:

fromF("file://%s", directory)
  .process(new Processor() {
    @Override
    public void process(Exchange exchange) throws Exception {
      // try to upload to a web server. Throw exception if failed
    });

This is working fine except that whenever an upload fails, camel logs a
message with a large stack trace. This means that every second or so the log
files grow by a couple of hundreds of lines, which is not ideal. I want to
do custom logging of this message, eg., print a single line with a short
message for each attempt. But so far, I haven't found a way of doing this.

If I add a custom error handler to the route above and mark the exception as
handled, the file component thinks that everything succeeded and deletes the
file. If I don't mark it as handled, the exception will still be logged by
the file component after it rollsback. Is it possible to change the way that
the File component logs these exceptions?

Thank you advance



--
View this message in context: 
http://camel.465427.n5.nabble.com/Custom-logging-of-exceptions-by-file-component-tp5735152.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to