3 Replies Latest reply on Jul 18, 2012 3:27 AM by ffang

    Override of a log4j appender : where should I add the class in my Fuse ?

    vmahe

      Hello everyone,

       

      I'm trying to override the MDCSiftingAppender which I find great except that I don't want any log whenever the MDC key is not found in the current thread context.

       

      I have written the following Java code :

       

      package com.orange.c4m.common.log;

       

      import org.apache.log4j.sift.MDCSiftingAppender;

      import org.apache.log4j.spi.LoggingEvent;

       

      public class SiftingWhileRejectingDefaultAppender extends MDCSiftingAppender {

       

           @Override

           protected void append(LoggingEvent event) {

                Object value = event.getMDC(getKey());

       

                if (value != null) {

                      

                     super.append(event);

                }

                else

                     System.out.println("SiftingWhileRejectingDefaultAppender : value is null !");

           }

      }

       

      But can you tell me how I deploy now this class so that I can use it in my org.ops4j.pax.logging.cfg file ?

       

      Thanks

       

      Regards,

       

      Vincent