Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.10.0
-
None
-
None
Description
The current order of system property sources (cf. documentation) 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. 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.
Attachments
Issue Links
- contains
-
LOG4J2-3193 ConfigurationFactory cannot find config file property normalized by EnvironmentPropertySource
- Closed
- fixes
-
LOG4J2-3287 document log4j2.system.properties file
- Resolved
- relates to
-
LOG4J2-3621 Log4J 2.19 breaks contract of order of loading of System Properties
- Resolved
- links to