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

Volkan Yazici commented on LOG4J2-3677:
---------------------------------------

[~jiagao], I have copy-pasted your code, run it against {{2.21.1}}, and it 
worked. I suspect your configuration might be overridden by some other source, 
e.g., one provided by environment variables? (See [System 
Properties|https://logging.apache.org/log4j/2.x/manual/configuration.html#system-properties]
 page of the manual on ordering of configuration sources.)

*Could you provide me an example that doesn't work against {{2.21.1}}, please?*

In the class you pointed, 
{{PropertiesUtil.getProperties().getStringProperty()}} is used, which performs 
fuzzy matching. Hence, both {{log4j.}} and {{log4j2.}} prefixes will be used 
for lookup. You can verify this yourself too:

{code:java}
Stream
        .of("log4j.configurationFactory", "log4j2.configurationFactory")
        .forEach(property -> System.out.format("%s=%s%n", property, 
PropertiesUtil.getProperties().getStringProperty(property)));
{code}

> System property log4j2.configurationFactory doesn't work
> --------------------------------------------------------
>
>                 Key: LOG4J2-3677
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3677
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Jiazhou Gao
>            Assignee: Volkan Yazici
>            Priority: Major
>
> We followed the wiki 
> [https://logging.apache.org/log4j/2.x/manual/customconfig.html]and set 
> -Dlog4j2.configurationFactory=<our customized configuration factory> in Java 
> opts.
> It used to work but seems broken after log4j2 2.17.1. Our 
> configurationFactory never started
> Now, we have to use system property log4j.configurationFactory and set 
> -Dlog4j.configurationFactory=<our customized configuration factory> in Java 
> opts
> So it looks like a regression in log4j2 latest versions
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to