You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2021/12/17 11:33:17 UTC

[GitHub] [logging-log4j2] qxo opened a new pull request #637: feat: lock feature by properties(PropertiesPropertySource order in properties)

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


   
   so we can change the load order if we need:
   such as lock some properties for force disable some feature we don't need.
   
   ie:
   
   SystemPropertiesPropertySource is priority=100, if we want log4j2.component.properties lock some properties(such as log4j2.enableJndi)
   that we do not want to be changed by system properties or ENV.
   with this feature, log4j2.component.properties as below:
   ```
   log4j2.enableJndi=false
   log4j.properties_load_priority=1000
   ```
   Our app do not need jndi lookup feature, so we want force disable it(Can't enable by -Dlog4j2.enableJndi=true or by ENV)
   


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [logging-log4j2] vy commented on a change in pull request #637: feat: lock feature by properties(PropertiesPropertySource order in properties)

Posted by GitBox <gi...@apache.org>.
vy commented on a change in pull request #637:
URL: https://github.com/apache/logging-log4j2/pull/637#discussion_r775014358



##########
File path: log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
##########
@@ -29,15 +29,21 @@
 
     private static final String PREFIX = "log4j2.";
 
+    private static final String KEY_PRIORITY = "log4j2.properties_load_priority";
+
+    private final int priority;
+
     private final Properties properties;
 
     public PropertiesPropertySource(final Properties properties) {
         this.properties = properties;
+        final String order = (String)properties.get(KEY_PRIORITY);

Review comment:
       Log4j has a fuzzy matching strategy, I am not sure if we can simply look for `KEY_PRIORITY` at this stage – the fuzzy key alternatives might not have been populated.

##########
File path: log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
##########
@@ -29,15 +29,21 @@
 
     private static final String PREFIX = "log4j2.";
 
+    private static final String KEY_PRIORITY = "log4j2.properties_load_priority";

Review comment:
       ```suggestion
       private static final String KEY_PRIORITY = "log4j2.propertySourcePriority";
   ```




-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org