ppkarwasz opened a new pull request #742:
URL: https://github.com/apache/logging-log4j2/pull/742


   This PR fixes the order of the property sources to:
   
   1. Spring Boot properties with lowest numerical priority (overrides all 
others). In a Spring Boot application with `log4j-spring` present it will use 
in order: the servlet context init parameters, JNDI environment entries (from 
`java:comp/env` exclusively), Java system properties and system environment 
variables (among others, cf. [the complete 
list](https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config)).
   2. Java system properties,
   3. OS environment variables,
   4. `log4j2.component.properties` to allow devs to provide some defaults.
   
   Due to some issues with the previous implementation, the logic of the 
`Environment` class has been rewritten:
   
   - the `normalized` map maps **any** key to the value of its normalization in 
the highest priority property source. E.g.: the key `log4j.configurationFile` 
will contain the value of the `log4j2.configurationFile` (remark the `2`) in 
Java's system properties or the value of the `LOG4J_CONFIGURATION_FILE` 
environment variable. Previously it contained two separate mappings: 
`log4j2.configurationFile` -> value in Java's system properties, 
`LOG4J_CONFIGURATION_FILE` -> value of the environment variable. This caused a 
miss for 95% of the `PropertiesUtil#getStringProperty` calls, which usually use 
the legacy property name.
   - the three caches (`normalized`, `literal` and `tokenized`) are filled in 
two steps: first we recover all the keys from **enumerable** sources and then 
we query **all** sources to retrieve the appropriate values. Previously 
non-enumerable sources didn't get a chance to provide a value in these caches 
(the Spring Boot property source is non-enumerable).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to