You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mkrishnap <mu...@gmail.com> on 2016/12/20 23:23:28 UTC
how to change the logging level dynamically
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.
Re: how to change the logging level dynamically
Posted by mkrishnap <mu...@gmail.com>.
Hi Yogesh,
I come across this approach.. By webpage interface
(LogManger.getLogger()) is not helping on getting the loggers into the
system.
My expectation is, is their any way, to get this
MyLoggingSentEventNotifer class logger and change through another java
class while the application up?
Thanks,
Murali
--
View this message in context: http://camel.465427.n5.nabble.com/how-to-change-the-logging-level-dynamically-tp5791782p5791814.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how to change the logging level dynamically
Posted by yogu13 <yo...@gmail.com>.
check JMX.. log4j configurations can be chabged via JMX
Regards,
-Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/how-to-change-the-logging-level-dynamically-tp5791782p5791813.html
Sent from the Camel - Users mailing list archive at Nabble.com.