FAQ
Log4j has a nice feature where you can throw variables into the MDC static
class and refer to them in the ConversionPattern in your log4j.properties.

I am using this to store an AuditId that I take from a SOAP header. Ideally
I'd like all log messages to be printed out with this AuditId however only
the code called from the Thread that receives the SOAP message has access to
this variable. As soon as the Camel Route is started then a different thread
runs and it has no access to this variable.

Is it possible to somehow pass the MDC into the Camel thread? My hack so far
is to pass the AuditId into the route as a Header and set the MDC again.

Thanks,

Damian.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-log-and-log4j-MDC-tp3299813p3299813.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

  • Claus Ibsen at Dec 10, 2010 at 5:07 am
    Camel 3.0 will switch to use slf4j which has such a feature as well.

    On Fri, Dec 10, 2010 at 5:30 AM, damianharvey wrote:

    Log4j has a nice feature where you can throw variables into the MDC static
    class and refer to them in the ConversionPattern in your log4j.properties.

    I am using this to store an AuditId that I take from a SOAP header. Ideally
    I'd like all log messages to be printed out with this AuditId however only
    the code called from the Thread that receives the SOAP message has access to
    this variable. As soon as the Camel Route is started then a different thread
    runs and it has no access to this variable.

    Is it possible to somehow pass the MDC into the Camel thread? My hack so far
    is to pass the AuditId into the route as a Header and set the MDC again.

    Thanks,

    Damian.
    --
    View this message in context: http://camel.465427.n5.nabble.com/Camel-log-and-log4j-MDC-tp3299813p3299813.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    -----------------
    FuseSource
    Email: cibsen@fusesource.com
    Web: http://fusesource.com
    Twitter: davsclaus
    Blog: http://davsclaus.blogspot.com/
    Author of Camel in Action: http://www.manning.com/ibsen/
  • Ext2 at Dec 10, 2010 at 7:45 am
    Hi:
    Camel support user to define custom InterceptStrategy;
    But the exchanged processed by the custom interceptor's cannot be
    logged by Camel's Tracer.
    This is because camel always wrap tracer before wrapping the custom
    interceptors;
    Maybe camel should wrap tracer after the custom interceptors;

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedDec 10, '10 at 4:30a
activeDec 10, '10 at 7:45a
posts3
users3
websitecamel.apache.org

3 users in discussion

Damianharvey: 1 post Claus Ibsen: 1 post Ext2: 1 post

People

Translate

site design / logo © 2021 Grokbase