camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Refering exchangeId through POJO for logging
Date Thu, 01 Oct 2009 13:02:12 GMT

Yeah at one point you gotta touch that part of Camel code to get that
exchange id.

Wonder if we should add an @ExchangeId annotation that you can use in
bean parameter binding to get that id?
Might be a bit overkill.

You can use interceptors to put the exchange id on the thread local.
For example interceptFromEndpoint which only intercepts new incoming exchanges.

See more here:

And the Camel wiki page as well

Basically something like

   <!-- as its a route you can do anything you like, but we use a low
practical processorRef -->
    <processorRef ref="myExchangeIdGrabber"/>

On Thu, Oct 1, 2009 at 2:46 PM, aptesameer <> wrote:
> Hi All,
> So far I have managed to keep my code as POJOs. I mean there is not a single
> line of code in java that hints that camel is being used.(All configuration
> sits happily in xml!)
> However, it is the logging approach that is bugging me. At present the
> logging that takes place through my pojo's cannot log exhange-id of the
> message for which the pojo's method is being called.
> I want camel-exchange id to be part of every logged statement so that I can
> have proper trace of the message in one go. [e.g. grep exchangeId
> logFileName]
> I was thinking over it.. and thought probably, I have to have a simple camel
> processor implementation that would set the exchange id in thread local.
> Once the exchange id is in thread local, my POJo's can simply get the value
> from thread local and log it along with other info.
> obviously every route should have <camel:bean ref="logHelper"/> immediately
> after <camel:from ref="abc">, so that exchange id would be available for
> other beans.
> Would be glad to know the opinion about this approach.../ some other
> approach that could help me out!
> Regards,
> Sameer
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Open Source Integration:

View raw message