logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4J2-1532) Don't throw an NPE from org.apache.logging.log4j.core.LoggerContext.setConfiguration(Configuration) when the configuration is missing
Date Thu, 18 Aug 2016 22:29:20 GMT
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message