You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by "Rick Kellogg (JIRA)" <ji...@apache.org> on 2015/10/09 02:27:27 UTC

[jira] [Updated] (STORM-97) Setting custom log levels per topology

     [ https://issues.apache.org/jira/browse/STORM-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Kellogg updated STORM-97:
------------------------------
    Component/s: storm-core

> Setting custom log levels per topology
> --------------------------------------
>
>                 Key: STORM-97
>                 URL: https://issues.apache.org/jira/browse/STORM-97
>             Project: Apache Storm
>          Issue Type: Improvement
>          Components: storm-core
>            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.3.4#6332)