Hi,

   i want to change the logging level dynamically by another java class.

    step1:
          we have written a logger, in this class. we are using the
log4j.properties for logger configuration
(http://camel.apache.org/how-do-i-use-log4j.html)

             public class MyLoggingSentEventNotifer extends
EventNotifierSupport {
         
        public void notify(EventObject event) throws Exception {
                 
        if (event instanceof ExchangeSentEvent) {
                
            ExchangeSentEvent sent = (ExchangeSentEvent) event;
            String endpoint = sent.getEndpoint() +"";
            if(endpoint.startsWith("Endpoint[cxf")){
                log.info("Operation name : "+ ((ExchangeSentEvent)
event).getExchange().getProperty("OPERATION_NAME") + "  Took " +
sent.getTimeTaken() + " millis to send to: " + sent.getEndpoint() );
            } else {
                log.debug("Operation name : "+ ((ExchangeSentEvent)
event).getExchange().getProperty("OPERATION_NAME") + " Took " +
sent.getTimeTaken() + " millis to send to: " + sent.getEndpoint() );
            }
        }
    }
        
    public boolean isEnabled(EventObject event) {
        // we only want the sent events
        return event instanceof ExchangeSentEvent;
    }
 
    protected void doStart() throws Exception {
        // noop
    }
 
    protected void doStop() throws Exception {
        // noop
    }
}

  step2:  we want to change the logging mechanism dynamically by another
interface. 

can anyone please explain me, what are ways to achieve it?

Thanks,
Murali
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/how-to-change-the-logging-level-dynamically-tp5791782.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to