[oops, sent too soon]
Hi All:
I'd like to tie up a loose end with callers of AbstractConfiguration.
AbstractConfiguration(LoggerContext, ConfigurationSource)
There are four call sites that do this:
super(null, ConfigurationSource.NULL_SOURCE);
These are:
-
org.apache.logging.log4j.core.BasicConfigurationFactory.BasicConfiguration.BasicConfiguration()
-
org.apache.logging.log4j.core.config.DefaultConfiguration.DefaultConfiguration()
- org.apache.logging.log4j.core.config.NullConfiguration.NullConfiguration()
-
org.apache.logging.log4j.core.config.composite.CompositeConfiguration.CompositeConfiguration(List<?
extends AbstractConfiguration>)
I am worried about this last one.
So I cannot null check the logger context in the AbstractConfiguration ctor:
protected AbstractConfiguration(LoggerContext loggerContext, final
ConfigurationSource configurationSource) {
this.loggerContext = new WeakReference<>(loggerContext);
// The loggerContext is null for the NullConfiguration class.
// this.loggerContext = new
WeakReference(Objects.requireNonNull(loggerContext, "loggerContext is
null"));
this.configurationSource =
Objects.requireNonNull(configurationSource, "configurationSource is null");
...
}
There are a couple of call sites where we could pass in a LC but we'd need
to add the LC to ctor for classes listed above. The default configs usually
include just console logging, but is that straight to the console or via a
ConsoleAppender?
I could even see adding a ctor
AbstractConfiguration.AbstractConfiguration(NullConfiguration)
to make it obvious that this is the only way is OK to pass null for the
logger context. Then the NullConfiguration ctor does not need to pass null.
Thoughts?
Gary
---------- Forwarded message ----------
From: Gary Gregory <[email protected]>
Date: Thu, Aug 25, 2016 at 8:54 PM
Subject: Tying up loose ends with
AbstractConfiguration.AbstractConfiguration(LoggerContext,
ConfigurationSource)
To: Log4J Developers List <[email protected]>
Hi All:
I'd like to tied up some loose end with Tying up loose ends with
AbstractConfiguration.AbstractConfiguration(LoggerContext,
ConfigurationSource)
There are three call sites that do this:
--
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
--
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory