You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2022/02/17 23:43:00 UTC

[jira] [Commented] (LOG4J2-3243) Property log4j.configurationFile incorrectly documented, log4j.configuration missing

    [ https://issues.apache.org/jira/browse/LOG4J2-3243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17494292#comment-17494292 ] 

Ralph Goers commented on LOG4J2-3243:
-------------------------------------

The line 

 
{code:java}
final String configLocationStr = this.substitutor.replace(PropertiesUtil.getProperties()
        .getStringProperty(CONFIGURATION_FILE_PROPERTY)); {code}
will return a value if either of the system properties {{log4j.configurationFile}} or {{log4j2.configurationFile}} have a value. See [https://logging.apache.org/log4j/2.x/manual/configuration.html#SystemProperties]

I have added a unit test that demonstrates that loading using log4j2.configurationFile works properly.

 

> Property log4j.configurationFile incorrectly documented, log4j.configuration missing
> ------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-3243
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3243
>             Project: Log4j 2
>          Issue Type: Documentation
>          Components: Configuration
>    Affects Versions: 2.16.0
>            Reporter: Sascha Volkenandt
>            Priority: Minor
>
> According to [1], Log4j looks for the system property log4j2.configurationFile. According to the sources of log4j-core-2.16.0 (ConfigurationFactory.java), the searched property is log4j.configurationFile. The other property does not seem to have any effect in recent versions.
> [1] [https://logging.apache.org/log4j/2.x/manual/configuration.html]
> Additionally, since 2.14.0 it looks for the property log4j.configuration (no "File"), which was also the property used by Log4j 1.x. As a consequence, logging stopped working in some of our systems after upgrading to 2.16.0 due to Log4Shell. Those systems are using both 1.x and 2.x so they have the property log4j.configuration set but not log4j.configurationFile, because we relied on the previous behaviour that if log4j.configurationFile is not set it looks in the classpath. I had to use a debugger to find out why it stopped working.
> It would be nice if that second property would also be mentioned in [1].



--
This message was sent by Atlassian Jira
(v8.20.1#820001)