ppkarwasz commented on code in PR #2396:
URL: https://github.com/apache/logging-log4j2/pull/2396#discussion_r1540045999


##########
log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfigurationFactory.java:
##########
@@ -45,18 +45,26 @@ public class PropertiesConfigurationFactory extends 
ConfigurationFactory {
      */
     protected static final String DEFAULT_PREFIX = "log4j";
 
+    private final boolean enabled;
+
+    public PropertiesConfigurationFactory() {
+        this(PropertyEnvironment.getGlobal());
+    }
+
+    private PropertiesConfigurationFactory(final PropertyEnvironment props) {
+        this.enabled = props.getBooleanProperty(LOG4J1_EXPERIMENTAL)
+                || props.getStringProperty(LOG4J1_CONFIGURATION_FILE_PROPERTY) 
!= null;
+    }
+
     @Override
     protected String[] getSupportedTypes() {
-        if (!PropertiesUtil.getProperties()
-                .getBooleanProperty(ConfigurationFactory.LOG4J1_EXPERIMENTAL, 
Boolean.FALSE)) {
-            return null;
-        }
-        return new String[] {FILE_EXTENSION};
+        return enabled ? new String[] {FILE_EXTENSION} : null;
     }
 
     @Override
     public Configuration getConfiguration(final LoggerContext loggerContext, 
final ConfigurationSource source) {
-        final int interval = 
PropertiesUtil.getProperties().getIntegerProperty(Log4j1Configuration.MONITOR_INTERVAL,
 0);
+        final int interval =
+                
PropertyEnvironment.getGlobal().getIntegerProperty(Log4j1Configuration.MONITOR_INTERVAL,
 0);

Review Comment:
   Nice catch



-- 
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-unsubscr...@logging.apache.org

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

Reply via email to