You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2021/12/17 02:33:49 UTC

[logging-log4j2] branch release-2.x updated: Extract constants.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 89b860a  Extract constants.
89b860a is described below

commit 89b860a1c7ba9cd7e537de8f3cd67a9be42ffb13
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 16 21:33:45 2021 -0500

    Extract constants.
---
 .../java/org/apache/log4j/config/PropertiesConfigurationFactory.java | 3 ++-
 .../src/main/java/org/apache/log4j/xml/XmlConfigurationFactory.java  | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfigurationFactory.java b/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfigurationFactory.java
index 6413214..d79b14e 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfigurationFactory.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfigurationFactory.java
@@ -32,6 +32,7 @@ import org.apache.logging.log4j.util.PropertiesUtil;
 @Order(2)
 public class PropertiesConfigurationFactory extends ConfigurationFactory {
 
+    static final String FILE_EXTENSION = ".properties";
 
     /**
      * File name prefix for test configurations.
@@ -48,7 +49,7 @@ public class PropertiesConfigurationFactory extends ConfigurationFactory {
         if (!PropertiesUtil.getProperties().getBooleanProperty(ConfigurationFactory.LOG4J1_EXPERIMENTAL, Boolean.FALSE)) {
             return null;
         }
-        return new String[] {".properties"};
+        return new String[] { FILE_EXTENSION };
     }
 
     @Override
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfigurationFactory.java b/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfigurationFactory.java
index 001b53a..965bce4 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfigurationFactory.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfigurationFactory.java
@@ -33,6 +33,9 @@ import org.apache.logging.log4j.util.PropertiesUtil;
 @Plugin(name = "Log4j1XmlConfigurationFactory", category = ConfigurationFactory.CATEGORY)
 @Order(2)
 public class XmlConfigurationFactory extends ConfigurationFactory {
+
+    public static final String FILE_EXTENSION = ".xml";
+
     private static final org.apache.logging.log4j.Logger LOGGER = StatusLogger.getLogger();
 
     /**
@@ -50,7 +53,7 @@ public class XmlConfigurationFactory extends ConfigurationFactory {
         if (!PropertiesUtil.getProperties().getBooleanProperty(ConfigurationFactory.LOG4J1_EXPERIMENTAL, Boolean.FALSE)) {
             return null;
         }
-        return new String[] {".xml"};
+        return new String[] { FILE_EXTENSION };
     }
 
     @Override