0 Replies Latest reply on Jun 6, 2012 9:58 AM by Vincent Mahe

    Strange behavior when using bundle.name MDC key with MDCSiftingAppender

    Vincent Mahe Newbie

      Hello Fuse gurus,

       

      I have tried to use the MDCSiftingAppender log4j appender in my org.ops4j.pax.logging.cfg configuration file.

       

      I have put the following instructions in my RouteBuilder configure() function :

      org.apache.log4j.MDC.put("bundle.name","order-manager");

      org.slf4j.MDC.put("bundle.name","order-manager");

       

      And also in a self-made processor that I put in one of my Camel routes :

      public void process(Exchange exchange) throws Exception

      {

      *     org.apache.log4j.MDC.put("bundle.name","order-manager");*

      *     org.slf4j.MDC.put("bundle.name","order-manager");*

      }

       

      I have restarted my Fuse 4.4.1.

       

      When I test my bundle :

      all the logs I generate with my processors, splitters, aggregator, ... via a log4j logger are logged in a separate log file named order-manager.log.

       

      So far, everything is fine but the strange thing is that all the logs that I generate with the LogEIP pattern in the routes of my bundle are still stored in some org.apache.camel.camel-core.log file !!!

      I have checked the thread id in the two log files and they are exactly the same, therefore, it is apparently not due to the fact that a MDC context applies to a local thread.

       

      Any clue why I have this kind of logging issue ?

       

      Thanks

       

      Regards