You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "paladox (JIRA)" <ji...@apache.org> on 2017/12/16 13:33:00 UTC
[jira] [Created] (LOG4J2-2154) Support resetting log levels
paladox created LOG4J2-2154:
-------------------------------
Summary: 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)