[
https://issues.apache.org/jira/browse/LOG4J2-960?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma updated LOG4J2-960:
-------------------------------
Fix Version/s: 2.5
Version 2.4 added better support for programmatic configuration with LOG4J2-952.
Can you try if this is still an issue with the latest version (2.4.1)?
> Custom ConfigurationFactory that uses no configuration file will never be used
> ------------------------------------------------------------------------------
>
> Key: LOG4J2-960
> URL: https://issues.apache.org/jira/browse/LOG4J2-960
> Project: Log4j 2
> Issue Type: Bug
> Components: Configurators
> Affects Versions: 2.1
> Environment: log4j 2.1, Java 1.7
> Reporter: Daniel Fowler
> Labels: configuration, newbie
> Fix For: 2.5
>
>
> If I create a custom ConfigurationFactory that accepts all configuration
> files (getSupportedTypes() returns String[] {"*"}) and do not specify a
> configuration file via the System property 'log4j.configurationFile' then the
> ConfigurationFactory that I specify will never be used.
> In org/apache/logging/log4j/core/config/ConfigurationFactory.java in method
> 'public Configuration getConfiguration(final String name, final URI
> configLocation)' configLocation will be null and when trying to load the
> configuration file System property for String config it will be null.
> The execution in the method will then skip down to these lines:
> Configuration config = getConfiguration(true, name);
> if (config == null) {
> In this case the custom configuration factory will not be used because in the
> method 'private Configuration getConfiguration(final boolean isTest, final
> String name)' skips over all configuration factories that return 'null' or
> 'String[] {"*"}' for factory.getSupportedTypes(). Therefore it will return
> null and eventually the Default configuration will be used.
> Therefore it is impossible to use a custom ConfigurationFactory without
> specifying the the System property 'log4j.configurationFile' which the
> documentation (http://logging.apache.org/log4j/2.0/manual/configuration.html)
> seems to imply should be programmatically permissible.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]