James Xu created STORM-97:
-----------------------------

             Summary: Setting custom log levels per topology
                 Key: STORM-97
                 URL: https://issues.apache.org/jira/browse/STORM-97
             Project: Apache Storm (Incubating)
          Issue Type: Improvement
            Reporter: James Xu
            Priority: Minor


https://github.com/nathanmarz/storm/issues/149

There is a log4j.xml that packaged in MyTopology.jar , when I startup the 
supervisor node, the task's logger use the config under the 
storm/log4j/storm.log.properties instead of my log4j.xml in jar .

Otherware, I want to dynamic adjust the logger level on the fly. for example, I 
run a normal java application, the first thing is load logger config. for 
example:

String log4jFile = System.getProperty("log4j.configuration","log4j.xml");
if (!(new File(log4jFile).isFile())) return;

String refreshInterval = System.getProperty("log4j.refreshInterval");
long interval = StringUtils.isNotBlank(refreshInterval) ? 
Long.valueOf(refreshInterval) : 2000;
try {
    Log4jConfigurer.initLogging(log4jFile, interval);
} catch (FileNotFoundException e) {
    throw new RuntimeException("no find the log4j file. file = " + log4jFile, 
e);
}
Use the above code, I can change the logger level and don't redeploy the 
application.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to