[ 
https://issues.apache.org/jira/browse/LOG4J2-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16293882#comment-16293882
 ] 

Ralph Goers commented on LOG4J2-2154:
-------------------------------------

I've looked at the code referenced in the link above and it isn't clear to me 
what the point is of what you are trying to do. It would be best if you could 
email the users list with what your requirements are in terms of how you want 
logging to behave and we can provide feedback on how to achieve that. Doing a 
straight translation of the code form Log4j 1 to Log4j 2 is usually not the 
best way to achieve the desired results.

> 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)

Reply via email to