You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2017/12/16 17:10:00 UTC

[jira] [Closed] (LOG4J2-2154) Support resetting log levels

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

Gary Gregory closed LOG4J2-2154.
--------------------------------
    Resolution: Not A Bug

Jira is not a support forum. May you please ask your question on our user's mailing list? See https://logging.apache.org/log4j/2.x/mail-lists.html

> Support resetting log levels
> ----------------------------
>
>                 Key: LOG4J2-2154
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2154
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: paladox
>
> Hi, would it be possible to support resetting log levels please?
> In log4j1.x we did the following
>   private static void reset() throws MalformedURLException {
>     for (Enumeration<Logger> logger = LogManager.getCurrentLoggers(); logger.hasMoreElements(); ) {
>       logger.nextElement().setLevel(null);
>     }
>     String path = System.getProperty(JAVA_OPTIONS_LOG_CONFIG);
>     if (Strings.isNullOrEmpty(path)) {
>       PropertyConfigurator.configure(Loader.getResource(LOG_CONFIGURATION));
>     } else {
>       PropertyConfigurator.configure(new URL(path));
>     }
>   }
> but in log4j2 setting null on log level results in null pointer when calling updateLogger().
> Also there dosen't seem to be a good replacement for PropertyConfigurator.configure as everything else just resets back to results thus if you used java to create appenders or anything else it would be erased and would not be re added until you restarted the java application.
> See https://gerrit-review.googlesource.com/#/c/gerrit/+/142811/



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)