Gary Gregory created LOG4J2-1532:
------------------------------------
Summary: Don't throw an NPE from
org.apache.logging.log4j.core.LoggerContext.setConfiguration(Configuration)
when the configuration is missing
Key: LOG4J2-1532
URL: https://issues.apache.org/jira/browse/LOG4J2-1532
Project: Log4j 2
Issue Type: Improvement
Components: Configurators
Affects Versions: 2.6.2, 2.6.1, 2.6
Reporter: Gary Gregory
Don't throw an NPE from
{{org.apache.logging.log4j.core.LoggerContext.setConfiguration(Configuration)}}
when the configuration is missing.
I am seeing this in a customer use case with what the customer says is version
"2.6.x."
The method
{{org.apache.logging.log4j.core.LoggerContext.setConfiguration(Configuration)}}
throws an exception when the given {{Configuration}} is null.
This can happen when the method is called by
{{org.apache.logging.log4j.core.LoggerContext.reconfigure(URI)}} and the file
backing the URI has disappeared.
Thoughts?
I propose that we either:
# Log an ERROR from
{{org.apache.logging.log4j.core.LoggerContext.setConfiguration(Configuration)}}
instead of throwing an NPE; or
# Change the implementation of
{{org.apache.logging.log4j.core.LoggerContext.reconfigure(URI)}} to check for a
null answer from
{{ConfigurationFactory.getInstance().getConfiguration(contextName, configURI,
cl);}} and log an ERROR if null.
# Do both (the best IMO.)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]