nathanmarz/storm — Issue #149: Setting custom log levels per topology
Author: macrochen
Created: 2012-03-04 06:43:04+00:00
State: open

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.