[
https://issues.apache.org/jira/browse/LOG4J2-1532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15427295#comment-15427295
]
Gary Gregory commented on LOG4J2-1532:
--------------------------------------
Also, since no one uses the return value from
{{org.apache.logging.log4j.core.LoggerContext.setConfiguration(Configuration)}},
I propose we change that method to be a void method.
> 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.6.1, 2.6.2
> Reporter: Gary Gregory
> Attachments: logging-log4j2.patch
>
>
> 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]