> On Jan 5, 2017, at 3:47 AM, Edoardo Comar <eco...@uk.ibm.com> wrote: > > "Jiangjie Qin (JIRA)" <j...@apache.org> wrote on 05/01/2017 08:06:58: > >> [ https://issues.apache.org/jira/browse/KAFKA-4497? >> page=com.atlassian.jira.plugin.system.issuetabpanels:comment- >> tabpanel&focusedCommentId=15800696#comment-15800696 ] >> >> Jiangjie Qin commented on KAFKA-4497: >> ------------------------------------- >> >> [~michael.andre.pearce] Thanks for helping test this again. >> >> If possible, could you enable trace level logging on >> kafka.log.LogSegment. This will print out the timestamp and the >> offset of the message with the largest timestamp, but it will >> probably flood the log4j log. So enable this logging is optional and >> preferred only when the issue can be reproduced pretty quickly. >> > > Is it possible to *dynamically* reconfigure log4j so that one could turn > tracing on/off for selected components > without editing the log4j.properties and restarting Kafka ? >
I've done it before using JMX. If you have JMX enabled, you can use jconsole, connect to kafka, and do a setLoggerLevel() to change the logging level of a particular package. It changes it on a live server, without needing to reboot. It does not save the change past a reboot. I found this page that has the steps (with screenshots) that show how to do it: http://www.javaworld.com/article/2073316/dynamic-java-log-levels-with-jmx-loggingmxbean--jconsole--visualvm--and-groovy.html <http://www.javaworld.com/article/2073316/dynamic-java-log-levels-with-jmx-loggingmxbean--jconsole--visualvm--and-groovy.html> -James > The log4j API supports a watch-file-and-reload > http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html#configureAndWatch(java.lang.String) > but apparently that cannot happen declaratively by just putting the > properties file on the classpath. > > Worth a new JIRA/KIP ? > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU