[
https://issues.apache.org/jira/browse/LOG4J2-3366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17534024#comment-17534024
]
ASF subversion and git services commented on LOG4J2-3366:
---------------------------------------------------------
Commit aaf13561e7dab88f379904461c75ed7a7ffef8d5 in logging-log4j2's branch
refs/heads/release-2.x from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=aaf13561e7 ]
[LOG4J2-3366] Fixes order of property sources
Fixes the order of property sources to work as documented and changes
the priorities of the sources: more specific sources (e.g. Spring
Environment) should have priority over global settings such as
environment variables.
> Fix order of property sources
> -----------------------------
>
> Key: LOG4J2-3366
> URL: https://issues.apache.org/jira/browse/LOG4J2-3366
> Project: Log4j 2
> Issue Type: Improvement
> Affects Versions: 2.10.0
> Reporter: Piotr Karwasz
> Assignee: Piotr Karwasz
> Priority: Minor
> Fix For: 2.18.0
>
>
> The current order of system property sources (cf.
> [documentation|https://logging.apache.org/log4j/2.x/manual/configuration.html#SystemProperties])
> is rather unnatural, because:
> # It gives a higher priority to environment variables than Java system
> properties. Java system properties apply to a single JVM, whereas environment
> variables might be shared between processes.
> # It mixes up property sources accessible to system administrators and those
> accessible only to programmers (`log4j2.component.properties`).
> IMHO Log4j should prioritize the sources accessible to system administrators
> over `log4j2.component.properties`, hence allowing them to easily override
> the defaults established by developers. It should also prioritize Java system
> properties over environment variables. This is what, e.g. [Spring Boot
> does|https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config].
> I propose the following order:
> # System properties,
> # Environment variables,
> # `log4j2.component.properties` as failover.
> While technically this would be a breaking change, the official property
> source order never worked and bug LOG4J2-3193 was filed only recently. This
> proves that almost no one configures the same property in more than one
> source.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)