You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2017/10/14 17:20:14 UTC

[01/15] logging-log4j2 git commit: Update @since to 2.9.1 where relevant

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 1357d4cc9 -> 9b8a17f4c


Update @since to 2.9.1 where relevant


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/74ed4f67
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/74ed4f67
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/74ed4f67

Branch: refs/heads/master
Commit: 74ed4f67168c462c517d6bac14300abe77c9e469
Parents: a010a2a
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 14:35:51 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../apache/logging/log4j/util/EnvironmentPropertySource.java   | 2 +-
 .../apache/logging/log4j/util/PropertiesPropertySource.java    | 2 +-
 .../java/org/apache/logging/log4j/util/PropertiesUtil.java     | 2 +-
 .../apache/logging/log4j/util/PropertyFilePropertySource.java  | 2 +-
 .../java/org/apache/logging/log4j/util/PropertySource.java     | 6 +++---
 .../logging/log4j/util/SystemPropertiesPropertySource.java     | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74ed4f67/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
index d413d61..03cdb7f 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
@@ -23,7 +23,7 @@ import java.util.Map;
  * with {@code LOG4J_} so as not to conflict with other variables. Normalized environment variables follow a scheme
  * like this: {@code log4j2.fooBarProperty} would normalize to {@code LOG4J_FOO_BAR_PROPERTY}.
  *
- * @since 2.9
+ * @since 2.9.1
  */
 public class EnvironmentPropertySource implements PropertySource {
     @Override

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74ed4f67/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
index 7622509..80777a6 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
@@ -23,7 +23,7 @@ import java.util.Properties;
  * PropertySource backed by a {@link Properties} instance. Normalized property names follow a scheme like this:
  * {@code Log4jContextSelector} would normalize to {@code log4j2.contextSelector}.
  *
- * @since 2.9
+ * @since 2.9.1
  */
 public class PropertiesPropertySource implements PropertySource {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74ed4f67/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index d8679ac..5e87349 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -283,7 +283,7 @@ public final class PropertiesUtil {
      *
      * Tokenized: loose matching based on word boundaries.
      *
-     * @since 2.9
+     * @since 2.9.1
      */
     private static class Environment {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74ed4f67/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
index 2920460..5b11718 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
@@ -24,7 +24,7 @@ import java.util.Properties;
 /**
  * PropertySource backed by a properties file. Follows the same conventions as {@link PropertiesPropertySource}.
  *
- * @since 2.9
+ * @since 2.9.1
  */
 public class PropertyFilePropertySource extends PropertiesPropertySource {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74ed4f67/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
index a197aec..c334879 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
 /**
  * A source for global configuration properties.
  *
- * @since 2.9
+ * @since 2.9.1
  */
 public interface PropertySource {
 
@@ -59,7 +59,7 @@ public interface PropertySource {
     /**
      * Comparator for ordering PropertySource instances by priority.
      *
-     * @since 2.9
+     * @since 2.9.1
      */
     class Comparator implements java.util.Comparator<PropertySource>, Serializable {
         private static final long serialVersionUID = 1L;
@@ -73,7 +73,7 @@ public interface PropertySource {
     /**
      * Utility methods useful for PropertySource implementations.
      *
-     * @since 2.9
+     * @since 2.9.1
      */
     final class Util {
         private static final String PREFIXES = "(?i:^log4j2?[-._/]?|^org\\.apache\\.logging\\.log4j\\.)?";

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/74ed4f67/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
index 8733f23..290a604 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
@@ -22,7 +22,7 @@ import java.util.Map;
  * PropertySource backed by the current system properties. Other than having a higher priority over normal properties,
  * this follows the same rules as {@link PropertiesPropertySource}.
  *
- * @since 2.9
+ * @since 2.9.1
  */
 public class SystemPropertiesPropertySource implements PropertySource {
 


[09/15] logging-log4j2 git commit: Add PropertiesUtil.reload() for unit tests

Posted by ma...@apache.org.
Add PropertiesUtil.reload() for unit tests


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/51f8e875
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/51f8e875
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/51f8e875

Branch: refs/heads/master
Commit: 51f8e875e528d538c2a9faf720051c4eafb5a396
Parents: 74ed4f6
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 15:02:49 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:57 2017 -0500

----------------------------------------------------------------------
 .../apache/logging/log4j/util/PropertiesUtil.java | 18 +++++++++++++++++-
 .../appender/db/jpa/AbstractJpaAppenderTest.java  |  3 +++
 .../async/AbstractAsyncThreadContextTestBase.java |  2 ++
 .../async/AsyncQueueFullPolicyFactoryTest.java    | 14 +++-----------
 4 files changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/51f8e875/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 5e87349..45438d2 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -273,6 +273,15 @@ public final class PropertiesUtil {
     }
 
     /**
+     * Reloads all properties. This is primarily useful for unit tests.
+     *
+     * @since 2.9.1
+     */
+    public void reload() {
+        environment.reload();
+    }
+
+    /**
      * Provides support for looking up global configuration properties via environment variables, property files,
      * and system properties, in three variations:
      *
@@ -287,16 +296,23 @@ public final class PropertiesUtil {
      */
     private static class Environment {
 
+        private final Set<PropertySource> sources = new TreeSet<>(new PropertySource.Comparator());
         private final Map<CharSequence, String> literal = new ConcurrentHashMap<>();
         private final Map<CharSequence, String> normalized = new ConcurrentHashMap<>();
         private final Map<List<CharSequence>, String> tokenized = new ConcurrentHashMap<>();
 
         private Environment(final PropertySource propertySource) {
-            final Set<PropertySource> sources = new TreeSet<>(new PropertySource.Comparator());
             sources.add(propertySource);
             for (final PropertySource source : ServiceLoader.load(PropertySource.class)) {
                 sources.add(source);
             }
+            reload();
+        }
+
+        private synchronized void reload() {
+            literal.clear();
+            normalized.clear();
+            tokenized.clear();
             for (final PropertySource source : sources) {
                 source.forEach(new BiConsumer<String, String>() {
                     @Override

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/51f8e875/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
index c61af57..517e98c 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
@@ -31,6 +31,7 @@ import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.config.DefaultConfiguration;
 import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -52,6 +53,7 @@ public abstract class AbstractJpaAppenderTest {
 
         System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
                 "org/apache/logging/log4j/core/appender/db/jpa/" + configFileName);
+        PropertiesUtil.getProperties().reload();
         final LoggerContext context = LoggerContext.getContext(false);
         if (context.getConfiguration() instanceof DefaultConfiguration) {
             context.reconfigure();
@@ -68,6 +70,7 @@ public abstract class AbstractJpaAppenderTest {
             ((JpaAppender) appender).getManager().close();
         } finally {
             System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
+            PropertiesUtil.getProperties().reload();
             context.reconfigure();
             StatusLogger.getLogger().reset();
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/51f8e875/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
index 00cad14..a590c2d 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AbstractAsyncThreadContextTestBase.java
@@ -32,6 +32,7 @@ import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.spi.DefaultThreadContextMap;
 import org.apache.logging.log4j.spi.LoggerContext;
 import org.apache.logging.log4j.spi.ReadOnlyThreadContextMap;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.apache.logging.log4j.util.Unbox;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -88,6 +89,7 @@ public abstract class AbstractAsyncThreadContextTestBase {
             System.clearProperty("log4j2.threadContextMap");
             final String PACKAGE = "org.apache.logging.log4j.spi.";
             System.setProperty("log4j2.threadContextMap", PACKAGE + implClassSimpleName());
+            PropertiesUtil.getProperties().reload();
             ThreadContextTestAccess.init();
         }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/51f8e875/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactoryTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactoryTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactoryTest.java
index 52d97c5..964bf12 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactoryTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactoryTest.java
@@ -18,7 +18,7 @@ package org.apache.logging.log4j.core.async;
 
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.categories.AsyncLoggers;
-import org.junit.After;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -31,19 +31,11 @@ import static org.junit.Assert.*;
 @Category(AsyncLoggers.class)
 public class AsyncQueueFullPolicyFactoryTest {
 
-    @After
-    public void after() {
-        clearProperties();
-    }
-
     @Before
-    public void before() {
-        clearProperties();
-    }
-
-    private void clearProperties() {
+    public void setUp() throws Exception {
         System.clearProperty(AsyncQueueFullPolicyFactory.PROPERTY_NAME_ASYNC_EVENT_ROUTER);
         System.clearProperty(AsyncQueueFullPolicyFactory.PROPERTY_NAME_DISCARDING_THRESHOLD_LEVEL);
+        PropertiesUtil.getProperties().reload();
     }
 
     @Test


[12/15] logging-log4j2 git commit: Add changelog entries

Posted by ma...@apache.org.
Add changelog entries


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d1a9ecfe
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d1a9ecfe
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d1a9ecfe

Branch: refs/heads/master
Commit: d1a9ecfe823056e54aeebee7d6bbda0c0c02d1ae
Parents: 36f7003
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 15:56:30 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:56:30 2017 -0500

----------------------------------------------------------------------
 src/changes/changes.xml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d1a9ecfe/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1c01aa5..b20527f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -30,9 +30,17 @@
          - "update" - Change
          - "remove" - Removed
     -->
+    <release version="2.9.1" date="2017-??-??" description="GA Release 2.9.1">
+      <action issue="LOG4J2-1431" dev="mattsicker" type="add">
+        Simplify log4j system property naming scheme.
+      </action>
+      <action issue="LOG4J2-1809" dev="mattsicker" type="add">
+        Add global configuration environment SPI.
+      </action>
+    </release>
     <release version="2.9.0" date="2017-08-26" description="GA Release 2.9.0">
       <action issue="LOG4J2-1928" dev="rgoers" type="update">
-        Add support for DirectWriteRolloverStrategy to RollingRandomAcessFileAppender.
+        Add support for DirectWriteRolloverStrategy to RollingRandomAccessFileAppender.
       </action>
       <action issue="LOG4J2-1833" dev="rgoers" type="fix">
         Prevent NullPointerException when a file name is specified with the DirectWriteRolloverStrategy.


[07/15] logging-log4j2 git commit: Fix system property resets in unit test

Posted by ma...@apache.org.
Fix system property resets in unit test


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/3efa9d41
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/3efa9d41
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/3efa9d41

Branch: refs/heads/master
Commit: 3efa9d41eaeb118bd5de28613d32e99cbfe0de01
Parents: bf06bb2
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 14:26:42 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../logging/log4j/core/util/ClockFactoryTest.java       | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3efa9d41/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java
index c9b3b91..309cc77 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/ClockFactoryTest.java
@@ -16,16 +16,16 @@
  */
 package org.apache.logging.log4j.core.util;
 
-import static org.junit.Assert.assertSame;
-
 import java.lang.reflect.Field;
 
 import org.apache.commons.lang3.reflect.FieldUtils;
 import org.apache.logging.log4j.core.async.AsyncLogger;
 import org.apache.logging.log4j.core.impl.Log4jLogEvent;
-import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.Test;
 
+import static org.junit.Assert.*;
+
 public class ClockFactoryTest {
 
     public static void resetClocks() throws IllegalAccessException {
@@ -40,11 +40,11 @@ public class ClockFactoryTest {
         FieldUtils.writeStaticField(field, ClockFactory.getClock(), false);
     }
 
-    @AfterClass
-    public static void afterClass() throws IllegalAccessException {
+    @Before
+    public void setUp() throws Exception {
         resetClocks();
     }
-    
+
     @Test
     public void testDefaultIsSystemClock() {
         System.clearProperty(ClockFactory.PROPERTY_NAME);


[05/15] logging-log4j2 git commit: Update property tokenizer to support ENV_VAR_STYLE

Posted by ma...@apache.org.
Update property tokenizer to support ENV_VAR_STYLE

This makes the property name tokenizer now support case-insensitive log4j(2) prefixes only at the beginning of a property name.

Also adds a missing license header.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/fd39ef45
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/fd39ef45
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/fd39ef45

Branch: refs/heads/master
Commit: fd39ef45225b60fc7d99b07e4303c4c802ca9929
Parents: d777b6f
Author: Matt Sicker <bo...@gmail.com>
Authored: Sun Feb 5 15:29:58 2017 -0600
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../logging/log4j/util/PropertySource.java      | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fd39ef45/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
index 4dd9cf3..a197aec 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.util;
 
 import java.io.Serializable;
@@ -60,8 +76,8 @@ public interface PropertySource {
      * @since 2.9
      */
     final class Util {
-        private static final String PREFIXES = "(?:[Ll]og4j2?|org\\.apache\\.logging\\.log4j\\.)?";
-        private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+)[-._/]?");
+        private static final String PREFIXES = "(?i:^log4j2?[-._/]?|^org\\.apache\\.logging\\.log4j\\.)?";
+        private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+|[A-Z0-9]+)[-._/]?");
         private static final Map<CharSequence, List<CharSequence>> CACHE = new ConcurrentHashMap<>();
 
         /**


[02/15] logging-log4j2 git commit: Add unit tests for property sources and utilities

Posted by ma...@apache.org.
Add unit tests for property sources and utilities


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/44254d2e
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/44254d2e
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/44254d2e

Branch: refs/heads/master
Commit: 44254d2edcd91cdfcb6fd1e92dde2cabb00057dc
Parents: fd39ef4
Author: Matt Sicker <bo...@gmail.com>
Authored: Sun Feb 5 15:30:48 2017 -0600
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../util/EnvironmentPropertySourceTest.java     | 58 ++++++++++++++++
 .../util/PropertiesPropertySourceTest.java      | 59 +++++++++++++++++
 .../log4j/util/PropertySourceCamelCaseTest.java | 57 ++++++++++++++++
 .../log4j/util/PropertySourceTokenizerTest.java | 69 ++++++++++++++++++++
 4 files changed, 243 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/44254d2e/log4j-api/src/test/java/org/apache/logging/log4j/util/EnvironmentPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/EnvironmentPropertySourceTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/EnvironmentPropertySourceTest.java
new file mode 100644
index 0000000..3beea89
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/EnvironmentPropertySourceTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+@RunWith(Parameterized.class)
+public class EnvironmentPropertySourceTest {
+
+    private final PropertySource source = new EnvironmentPropertySource();
+    private final CharSequence expected;
+    private final List<? extends CharSequence> tokens;
+
+    public EnvironmentPropertySourceTest(final CharSequence expected, final List<? extends CharSequence> tokens) {
+        this.expected = expected;
+        this.tokens = tokens;
+    }
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Object[][] data() {
+        return new Object[][]{
+            {"LOG4J_CONFIGURATION_FILE", Arrays.asList("configuration", "file")},
+            {"LOG4J_FOO_BAR_PROPERTY", Arrays.asList("foo", "bar", "property")},
+            {"LOG4J_EXACT", Collections.singletonList("EXACT")},
+            {"LOG4J_TEST_PROPERTY_NAME", PropertySource.Util.tokenize("Log4jTestPropertyName")},
+        };
+    }
+
+    @Test
+    public void testNormalFormFollowsEnvironmentVariableConventions() throws Exception {
+        assertEquals(expected, source.getNormalForm(tokens));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/44254d2e/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
new file mode 100644
index 0000000..2f07972
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+@RunWith(Parameterized.class)
+public class PropertiesPropertySourceTest {
+
+    private final PropertySource source = new PropertiesPropertySource(new Properties());
+    private final CharSequence expected;
+    private final List<? extends CharSequence> tokens;
+
+    public PropertiesPropertySourceTest(final String expected, final List<CharSequence> tokens) {
+        this.expected = expected;
+        this.tokens = tokens;
+    }
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Object[][] data() {
+        return new Object[][]{
+            {"log4j2.configurationFile", Arrays.asList("configuration", "file")},
+            {"log4j2.fooBarProperty", Arrays.asList("foo", "bar", "property")},
+            {"log4j2.EXACT", Collections.singletonList("EXACT")},
+            {"log4j2.testPropertyName", PropertySource.Util.tokenize("Log4jTestPropertyName")},
+        };
+    }
+
+    @Test
+    public void testNormalFormFollowsCamelCaseConventions() throws Exception {
+        assertEquals(expected, source.getNormalForm(tokens));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/44254d2e/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
new file mode 100644
index 0000000..c746199
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+@RunWith(Parameterized.class)
+public class PropertySourceCamelCaseTest {
+
+    private final CharSequence expected;
+    private final List<String> tokens;
+
+    public PropertySourceCamelCaseTest(final CharSequence expected, final List<String> tokens) {
+        this.expected = expected;
+        this.tokens = tokens;
+    }
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Object[][] data() {
+        return new Object[][]{
+            {"", Collections.singletonList("")},
+            {"foo", Collections.singletonList("foo")},
+            {"fooBar", Arrays.asList("foo", "bar")},
+            {"oneTwoThree", Arrays.asList("one", "two", "three")},
+        };
+    }
+
+    @Test
+    public void testJoinAsCamelCase() throws Exception {
+        assertEquals(expected, PropertySource.Util.joinAsCamelCase(tokens));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/44254d2e/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
new file mode 100644
index 0000000..3b25af7
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ *
+ */
+@RunWith(Parameterized.class)
+public class PropertySourceTokenizerTest {
+
+    private final CharSequence value;
+    private final List<CharSequence> expectedTokens;
+
+    public PropertySourceTokenizerTest(final CharSequence value, final List<CharSequence> expectedTokens) {
+        this.value = value;
+        this.expectedTokens = expectedTokens;
+    }
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Object[][] data() {
+        return new Object[][]{
+            {"log4j.simple", Collections.singletonList("simple")},
+            {"log4j_simple", Collections.singletonList("simple")},
+            {"log4j-simple", Collections.singletonList("simple")},
+            {"log4j/simple", Collections.singletonList("simple")},
+            {"log4j2.simple", Collections.singletonList("simple")},
+            {"Log4jSimple", Collections.singletonList("simple")},
+            {"LOG4J_simple", Collections.singletonList("simple")},
+            {"org.apache.logging.log4j.simple", Collections.singletonList("simple")},
+            {"log4j.simpleProperty", Arrays.asList("simple", "property")},
+            {"log4j.simple_property", Arrays.asList("simple", "property")},
+            {"LOG4J_simple_property", Arrays.asList("simple", "property")},
+            {"LOG4J_SIMPLE_PROPERTY", Arrays.asList("simple", "property")},
+            {"log4j2-dashed-propertyName", Arrays.asList("dashed", "property", "name")},
+            {"Log4jProperty_with.all-the/separators", Arrays.asList("property", "with", "all", "the", "separators")},
+            {"org.apache.logging.log4j.config.property", Arrays.asList("config", "property")},
+        };
+    }
+
+    @Test
+    public void testTokenize() throws Exception {
+        List<CharSequence> tokens = PropertySource.Util.tokenize(value);
+        assertEquals(expectedTokens, tokens);
+    }
+}
\ No newline at end of file


[11/15] logging-log4j2 git commit: Update manual for LOG4J2-1431 and LOG4J2-1809

Posted by ma...@apache.org.
Update manual for LOG4J2-1431 and LOG4J2-1809


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/36f70030
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/36f70030
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/36f70030

Branch: refs/heads/master
Commit: 36f70030762b9b29d87b747f769ef6f90f76c83b
Parents: 11dd04a
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 15:50:34 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:57 2017 -0500

----------------------------------------------------------------------
 src/site/xdoc/manual/async.xml            |  46 +++---
 src/site/xdoc/manual/configuration.xml.vm | 187 +++++++++++++++++++++++--
 src/site/xdoc/manual/customconfig.xml     |   2 +-
 src/site/xdoc/manual/eventlogging.xml     |   4 +-
 src/site/xdoc/manual/extending.xml        |   8 +-
 src/site/xdoc/manual/flowtracing.xml      |   4 +-
 src/site/xdoc/manual/garbagefree.xml      |  13 +-
 src/site/xdoc/manual/jmx.xml.vm           |   2 +-
 src/site/xdoc/manual/logsep.xml           |   6 +-
 src/site/xdoc/manual/thread-context.xml   |   2 +-
 10 files changed, 223 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/async.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/async.xml b/src/site/xdoc/manual/async.xml
index c7a000a..763f398 100644
--- a/src/site/xdoc/manual/async.xml
+++ b/src/site/xdoc/manual/async.xml
@@ -92,19 +92,19 @@
             <code>myObject</code> parameter at the time of the call to <code>logger.debug()</code>.
             The log message will not change even if <code>myObject</code> is modified later.
             It is safe to asynchronously log mutable objects because most
-            <a href="../log4j-api/apidocs/org/apache/logging/log4j/message/Message.html">Message</a>
+            <a class="javadoc" href="../log4j-api/apidocs/org/apache/logging/log4j/message/Message.html">Message</a>
             implementations built-in to Log4j take a snapshot of the parameters.
             There are some exceptions however:
-            <a
+            <a class="javadoc"
               href="../log4j-api/apidocs/org/apache/logging/log4j/message/MapMessage.html">MapMessage</a>
             and
-            <a
+            <a class="javadoc"
               href="../log4j-api/apidocs/org/apache/logging/log4j/message/StructuredDataMessage.html">StructuredDataMessage</a>
             are mutable by design: fields can be added to these messages after the message object was created.
             These messages should not be modified after they are logged with asynchronous loggers or
             asynchronous appenders; you may or may not see the modifications in the resulting log output.
             Similarly, custom
-            <a
+            <a class="javadoc"
               href="../log4j-api/apidocs/org/apache/logging/log4j/message/Message.html">Message</a>
             implementations should be designed with asynchronous use in mind, and either take a snapshot
             of their parameters at construction time, or document their thread-safety characteristics.
@@ -132,7 +132,7 @@
         </p>
         <p>
           This is simplest to configure and gives the best performance. To make all loggers asynchronous,
-          add the disruptor jar to the classpath and set the system property <tt>Log4jContextSelector</tt>
+          add the disruptor jar to the classpath and set the system property <tt>log4j2.contextSelector</tt>
           to <tt>org.apache.logging.log4j.core.async.AsyncLoggerContextSelector</tt>.
         </p>
         <p>
@@ -146,7 +146,7 @@
         <pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 
 <!-- Don't forget to set system property
--DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
+-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
      to make all loggers asynchronous. -->
 
 <Configuration status="WARN">
@@ -183,6 +183,10 @@
           The below properties can also be specified by creating a file named
           <tt>log4j2.component.properties</tt> and including this file in the classpath of the application.
         </p>
+        <p>
+          Note that system properties were renamed into a more consistent style in Log4j 2.9.1. All old property
+          names are still supported which are documented <a href="configuration.html#SystemProperties">here</a>.
+        </p>
         <a name="SysPropsAllAsync" />
         <table>
           <caption align="top">System Properties to configure all asynchronous loggers
@@ -193,7 +197,7 @@
             <th>Description</th>
           </tr>
           <tr>
-            <td>AsyncLogger.ExceptionHandler</td>
+            <td>log4j2.asyncLoggerExceptionHandler</td>
             <td>
               <tt>default handler</tt>
             </td>
@@ -208,7 +212,7 @@
             </td>
           </tr>
           <tr>
-            <td>AsyncLogger.RingBufferSize</td>
+            <td>log4j2.asyncLoggerRingBufferSize</td>
             <td>256&#160;*&#160;1024</td>
             <td>
               Size (number of slots) in the RingBuffer used by the asynchronous logging subsystem.
@@ -223,7 +227,7 @@
             </td>
           </tr>
           <tr>
-            <td>AsyncLogger.WaitStrategy</td>
+            <td>log4j2.asyncLoggerWaitStrategy</td>
             <td>
               <tt>Timeout</tt>
             </td>
@@ -251,7 +255,7 @@
             </td>
           </tr>
           <tr>
-            <td>AsyncLogger.ThreadNameStrategy</td>
+            <td>log4j2.asyncLoggerThreadNameStrategy</td>
             <td>
               <tt>CACHED</tt>
             </td>
@@ -265,7 +269,7 @@
             </td>
           </tr>
           <tr>
-            <td>log4j.Clock</td>
+            <td>log4j2.clock</td>
             <td>
               <tt>SystemClock</tt>
             </td>
@@ -297,8 +301,8 @@
           There are also a few system properties that can be used to maintain application throughput even when
           the underlying appender cannot keep up with the logging rate and the queue is filling up.
           See the details for system properties
-          <a href="configuration.html#log4j2.AsyncQueueFullPolicy"><tt>log4j2.AsyncQueueFullPolicy</tt> and
-            <tt>log4j2.DiscardThreshold</tt></a>.
+          <a href="configuration.html#asyncQueueFullPolicy"><tt>log4j2.asyncQueueFullPolicy</tt> and
+            <tt>log4j2.discardThreshold</tt></a>.
         </p>
       </subsection>
       <a name="MixedSync-Async" />
@@ -329,7 +333,7 @@
         </p>
         <pre class="prettyprint linenums"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 
-<!-- No need to set system property "Log4jContextSelector" to any value
+<!-- No need to set system property "log4j2.contextSelector" to any value
      when using <asyncLogger> or <asyncRoot>. -->
 
 <Configuration status="WARN">
@@ -360,6 +364,10 @@
           The below properties can also be specified by creating a file named
           <tt>log4j2.component.properties</tt> and including this file in the classpath of the application.
         </p>
+        <p>
+          Note that system properties were renamed into a more consistent style in Log4j 2.9.1. All old property
+          names are still supported which are documented <a href="configuration.html#SystemProperties">here</a>.
+        </p>
         <a name="SysPropsMixedSync-Async" />
         <table>
           <caption align="top">System Properties to configure mixed asynchronous and normal loggers</caption>
@@ -369,7 +377,7 @@
             <th>Description</th>
           </tr>
           <tr>
-            <td>AsyncLoggerConfig.ExceptionHandler</td>
+            <td>log4j2.asyncLoggerConfigExceptionHandler</td>
             <td>
               <tt>default handler</tt>
             </td>
@@ -384,7 +392,7 @@
             </td>
           </tr>
           <tr>
-            <td>AsyncLoggerConfig.RingBufferSize</td>
+            <td>log4j2.asyncLoggerConfigRingBufferSize</td>
             <td>256&#160;*&#160;1024</td>
             <td>
               Size (number of slots) in the RingBuffer used by the asynchronous logging subsystem.
@@ -399,7 +407,7 @@
             </td>
           </tr>
           <tr>
-            <td>AsyncLoggerConfig.WaitStrategy</td>
+            <td>log4j2.asyncLoggerConfigWaitStrategy</td>
             <td>
               <tt>Timeout</tt>
             </td>
@@ -431,8 +439,8 @@
           There are also a few system properties that can be used to maintain application throughput even when
           the underlying appender cannot keep up with the logging rate and the queue is filling up.
           See the details for system properties
-          <a href="configuration.html#log4j2.AsyncQueueFullPolicy"><tt>log4j2.AsyncQueueFullPolicy</tt> and
-            <tt>log4j2.DiscardThreshold</tt></a>.
+          <a href="configuration.html#asyncQueueFullPolicy"><tt>log4j2.asyncQueueFullPolicy</tt> and
+            <tt>log4j2.discardThreshold</tt></a>.
         </p>
       </subsection>
       <a name="Location" />

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/configuration.xml.vm
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/configuration.xml.vm b/src/site/xdoc/manual/configuration.xml.vm
index fcfff70..e7b1e12 100644
--- a/src/site/xdoc/manual/configuration.xml.vm
+++ b/src/site/xdoc/manual/configuration.xml.vm
@@ -1571,19 +1571,71 @@ public class AwesomeTest {
           Any spaces present in the property name are for visual flow and should be removed.
         </p>
           <p>
-            The properties listed below can also be specified by creating a file named
-            <tt>log4j2.component.properties</tt>, adding the desired keys and value to the file, and then including
-            the file in the classpath of the application.
+            Note that beginning in Log4j 2.9.1, all system property names have been normalized to follow a consistent
+            naming scheme. While the old property names are still supported for backwards compatibility, it is
+            recommended to update configurations to use the new style. This system is extensible and is enabled
+            through the
+            <a class="javadoc" href="../log4j-api/apidocs/org/apache/logging/log4j/util/PropertySource.html">PropertySource</a>
+            interface. Additional property source classes can be added through the standard <code>ServiceLoader</code>
+            mechanism in Java SE.
+          </p>
+          <p>
+            Properties can be overridden by sources with a lower number priority (e.g.., -100 comes before 100). The
+            following sources are all available by default:
+          </p>
+          <table>
+            <caption align="top">PropertySource priorities and descriptions</caption>
+            <tr>
+              <th>Source</th>
+              <th>Priority</th>
+              <th>Description</th>
+            </tr>
+            <tr>
+              <td>Environment Variables</td>
+              <td>-100</td>
+              <td>
+                Environment variables are all prefixed with <code>LOG4J_</code>, are in all caps, and words are all
+                separated by underscores. Only this naming scheme is support for environment variables as there were
+                no old naming schemes to maintain compatibility with.
+              </td>
+            </tr>
+            <tr>
+              <td><code>log4j2.component.properties</code> file</td>
+              <td>0</td>
+              <td>
+                Including this file on the classpath can be used as an alternative to providing properties as system
+                properties. This has priority over system properties, but they can be overridden by environment
+                variables as described above.
+              </td>
+            </tr>
+            <tr>
+              <td>System Properties</td>
+              <td>100</td>
+              <td>
+                All properties can be set using normal system property patterns. These have the lowest priority and
+                can be overridden by included properties files or environment variables.
+              </td>
+            </tr>
+          </table>
+          <p>
+            The following is a list of available global configuration properties. Note that these can only be set once
+            per JVM process unlike configuration settings available in configuration files. The <i>Property Name</i>
+            column contains the name used in properties files and system properties; <i>Environemt Variable</i>
+            for the equivalent environment variable; and <i>Legacy Property Name</i> for the pre-2.9.1 name.
           </p>
 <table>
-  <caption align="top">Log4j 2 System Properties</caption>
+  <caption align="top">Log4j 2 global configuration properties</caption>
   <tr>
-    <th>System Property</th>
+    <th>Property Name</th>
+    <th>Environment Variable</th>
+    <td>Legacy Property Name</td>
     <th>Default Value</th>
     <th>Description</th>
   </tr>
 
   <tr>
+    <td><a name="configurationFile"/>log4j2.configurationFile</td>
+    <td>LOG4J_CONFIGURATION_FILE</td>
     <td><a name="log4j.configurationFile"/>log4j.configurationFile</td>
     <td>&nbsp;</td>
     <td>
@@ -1592,6 +1644,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="debug"/>log4j2.debug</td>
+    <td>LOG4J_DEBUG</td>
     <td><a name="log4j2.debug"/>log4j2.debug</td>
     <td>&nbsp;</td>
     <td>
@@ -1600,6 +1654,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="mergeFactory"/>log4j2.mergeFactory</td>
+    <td>LOG4J_MERGE_FACTORY</td>
     <td><a name="log4j.mergeFactory"/>log4j.mergeFactory</td>
     <td>&nbsp;</td>
     <td>
@@ -1608,6 +1664,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="contextSelector"/>log4j2.contextSelector</td>
+    <td>LOG4J_CONTEXT_SELECTOR</td>
     <td><a name="Log4jContextSelector"/>Log4jContextSelector</td>
     <td>ClassLoaderContextSelector</td>
     <td>
@@ -1624,6 +1682,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="logEventFactory"/>log4j2.logEventFactory</td>
+    <td>LOG4J_LOG_EVENT_FACTORY</td>
     <td><a name="Log4jLogEventFactory"/>Log4jLogEventFactory</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td>org.apache.logging.log4j.core.impl .DefaultLogEventFactory</td>
@@ -1633,6 +1693,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="loggerContextFactory"/>log4j2.loggerContextFactory</td>
+    <td>LOG4J_LOGGER_CONTEXT_FACTORY</td>
     <td><a name="log4j2.loggerContextFactory"/>log4j2.loggerContextFactory</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td>org.apache.logging.log4j.simple .SimpleLoggerContextFactory</td>
@@ -1642,6 +1704,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="configurationFactory"/>log4j2.configurationFactory</td>
+    <td>LOG4J_CONFIGURATION_FACTORY</td>
     <td><a name="log4j.configurationFactory"/>log4j.configurationFactory</td>
     <td>&nbsp;</td>
     <td>
@@ -1650,6 +1714,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="shutdownHookEnabled"/>log4j2.shutdownHookEnabled</td>
+    <td>LOG4J_SHUTDOWN_HOOK_ENABLED</td>
     <td><a name="log4j.shutdownHookEnabled"/>log4j.shutdownHookEnabled</td>
     <td>true</td>
     <td>
@@ -1659,6 +1725,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="shutdownCallbackRegistry"/>log4j2.shutdownCallbackRegistry</td>
+    <td>LOG4J_SHUTDOWN_CALLBACK_REGISTRY</td>
     <td><a name="log4j.shutdownCallbackRegistry"/>log4j.shutdownCallbackRegistry</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td>org.apache.logging.log4j.core.util .DefaultShutdownCallbackRegistry</td>
@@ -1670,6 +1738,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="clock"/>log4j2.clock</td>
+    <td>LOG4J_CLOCK</td>
     <td><a name="log4j.Clock"/>log4j.Clock</td>
     <td>SystemClock</td>
     <td>
@@ -1683,6 +1753,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="level"/>log4j2.level</td>
+    <td>LOG4J_LEVEL</td>
     <td><a name="org.apache.logging.log4j.level"/>org.apache.logging.log4j.level</td>
     <td>ERROR</td>
     <td>
@@ -1690,9 +1762,10 @@ public class AwesomeTest {
       could not successfully create a configuration (e.g. no log4j2.xml file was found).
     </td>
   </tr>
-
   <tr>
-    <td><a name="disableThreadContext"/>disableThreadContext</td>
+    <td><a name="disableThreadContext"/>log4j2.disableThreadContext</td>
+    <td>LOG4J_DISABLE_THREAD_CONTEXT</td>
+    <td>disableThreadContext</td>
     <td>false</td>
     <td>
       If <tt>true</tt>, the ThreadContext stack and map are disabled.
@@ -1700,14 +1773,18 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
-    <td><a name="disableThreadContextStack"/>disableThreadContextStack</td>
+    <td><a name="disableThreadContextStack"/>log4j2.disableThreadContextStack</td>
+    <td>LOG4J_DISABLE_THREAD_CONTEXT_STACK</td>
+    <td>disableThreadContextStack</td>
     <td>false</td>
     <td>
       If <tt>true</tt>, the ThreadContext stack is disabled.
     </td>
   </tr>
   <tr>
-    <td><a name="disableThreadContextMap"/>disableThreadContextMap</td>
+    <td><a name="disableThreadContextMap"/>log4j2.disableThreadContextMap</td>
+    <td>LOG4J_DISABLE_THREAD_CONTEXT_MAP</td>
+    <td>disableThreadContextMap</td>
     <td>false</td>
     <td>
       If <tt>true</tt>, the ThreadContext map is disabled.
@@ -1716,13 +1793,17 @@ public class AwesomeTest {
   </tr>
   <tr>
     <td><a name="log4j2.threadContextMap"/>log4j2.threadContextMap</td>
+    <td>LOG4J_THREAD_CONTEXT_MAP</td>
+    <td>log4j2.threadContextMap</td>
     <td>&nbsp;</td>
     <td>
       Fully specified class name of a custom <tt>ThreadContextMap</tt> implementation class.
     </td>
   </tr>
   <tr>
-    <td><a name="isThreadContextMapInheritable"/>isThreadContextMapInheritable</td>
+    <td><a name="isThreadContextMapInheritable"/>log4j2.isThreadContextMapInheritable</td>
+    <td>LOG4J_IS_THREAD_CONTEXT_MAP_INHERITABLE</td>
+    <td>isThreadContextMapInheritable</td>
     <td>false</td>
     <td>
       If <tt>true</tt> use a <tt>InheritableThreadLocal</tt> to implement the ThreadContext map.
@@ -1731,6 +1812,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="contextDataInjector"/>log4j2.contextDataInjector</td>
+    <td>LOG4J_CONTEXT_DATA_INJECTOR</td>
     <td><a name="log4j2.ContextDataInjector"/>log4j2.ContextDataInjector</td>
     <td>&nbsp;</td>
     <td>
@@ -1738,6 +1821,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="garbagefreeThreadContextMap"/>log4j2.garbagefreeThreadContextMap</td>
+    <td>LOG4J_GARBAGEFREE_THREAD_CONTEXT_MAP</td>
     <td><a name="log4j2.garbagefree.threadContextMap"/>log4j2.garbagefree.threadContextMap</td>
     <td>false</td>
     <td>
@@ -1745,6 +1830,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="disableJmx"/>log4j2.disableJmx</td>
+    <td>LOG4J_DISABLE_JMX</td>
     <td><a name="log4j2.disable.jmx"/>log4j2.disable.jmx</td>
     <td>false</td>
     <td>
@@ -1753,6 +1840,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="jmxNotifyAsync"/>log4j2.jmxNotifyAsync</td>
+    <td>LOG4J_JMX_NOTIFY_ASYNC</td>
     <td><a name="log4j2.jmx.notify.async"/>log4j2.jmx.notify.async</td>
     <td>false for web apps, true otherwise</td>
     <td>
@@ -1764,6 +1853,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="skipJansi"/>log4j2.skipJansi</td>
+    <td>LOG4J_SKIP_JANSI</td>
     <td><a name="log4j.skipJansi"/>log4j.skipJansi</td>
     <td>false</td>
     <td>
@@ -1771,6 +1862,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="ignoreTCL"/>log4j2.ignoreTCL</td>
+    <td>LOG4J_IGNORE_TCL</td>
     <td><a name="log4j.ignoreTCL"/>log4j.ignoreTCL</td>
     <td>false</td>
     <td>
@@ -1780,6 +1873,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="uuidSequence"/>log4j2.uuidSequence</td>
+    <td>LOG4J_UUID_SEQUENCE</td>
     <td><a name="org.apache.logging.log4j.uuidSequence"/>org.apache.logging.log4j.uuidSequence</td>
     <td>0</td>
     <td>
@@ -1788,6 +1883,8 @@ public class AwesomeTest {
   </tr>
   <!--
   <tr>
+    <td><a name="assignedSequences">log4j2.assignedSequences</td>
+    <td>LOG4J_ASSIGNED_SEQUENCES</td>
     <td><a name="org.apache.logging.log4j.assignedSequences"/>org.apache.logging.log4j.assignedSequences</td>
     <td>true</td>
     <td>
@@ -1796,18 +1893,24 @@ public class AwesomeTest {
   </tr>
   -->
   <tr>
+    <td><a name="simplelogShowContextMap"/>log4j2.simplelogShowContextMap</td>
+    <td>LOG4J_SIMPLELOG_SHOW_CONTEXT_MAP</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.showContextMap"/>org.apache.logging.log4j.simplelog .showContextMap</td>
     <td>false</td>
     <td>If <tt>true</tt>, the full ThreadContext map is included in each SimpleLogger log message.</td>
   </tr>
   <tr>
+    <td><a name="simplelogShowlogname"/>log4j2.simplelogShowlogname</td>
+    <td>LOG4J_SIMPLELOG_SHOWLOGNAME</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.showlogname"/>org.apache.logging.log4j.simplelog .showlogname</td>
     <td>false</td>
     <td>If <tt>true</tt>, the logger name is included in each SimpleLogger log message.</td>
   </tr>
   <tr>
+    <td><a name="simplelogShowShortLogname"/>log4j2.simplelogShowShortLogname</td>
+    <td>LOG4J_SIMPLELOG_SHOW_SHORT_LOGNAME</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.showShortLogname"/>org.apache.logging.log4j.simplelog .showShortLogname</td>
     <td>true</td>
@@ -1816,6 +1919,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="simplelogShowdatetime"/>log4j2.simplelogShowdatetime</td>
+    <td>LOG4J_SIMPLELOG_SHOWDATETIME</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.showdatetime"/>org.apache.logging.log4j.simplelog .showdatetime</td>
     <td>false</td>
@@ -1823,6 +1928,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="simplelogDateTimeFormat"/>log4j2.simplelogDateTimeFormat</td>
+    <td>LOG4J_SIMPLELOG_DATE_TIME_FORMAT</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.dateTimeFormat"/>org.apache.logging.log4j.simplelog .dateTimeFormat</td>
     <td>"yyyy/MM/dd HH:mm:ss:SSS zzz"</td>
@@ -1831,8 +1938,10 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="simplelogLogFile"/>log4j2.simplelogLogFile</td>
+    <td>LOG4J_SIMPLELOG_LOG_FILE</td>
     <!-- deliberately inserted spaces to allow line break -->
-    <td><a name="org.apache.logging.logj.simplelog.logFile"/>org.apache.logging.logj.simplelog .logFile</td>
+    <td><a name="org.apache.logging.log4j.simplelog.logFile"/>org.apache.logging.log4j.simplelog .logFile</td>
     <td>system.err</td>
     <td>"system.err" (case-insensitive) logs to System.err,
     "system.out" (case-insensitive) logs to System.out,
@@ -1840,6 +1949,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="simplelogLevel"/>log4j2.simplelogLevel</td>
+    <td>LOG4J_SIMPLELOG_LEVEL</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.level"/>org.apache.logging.log4j.simplelog .level</td>
     <td>ERROR</td>
@@ -1847,12 +1958,16 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td>log4j2.simplelog.&lt;loggerName&gt;.level</td>
+    <td>LOG4J_SIMPLELOG_&lt;LOGGER_NAME&gt;_LEVEL</td>
     <!-- deliberately inserted spaces to allow line break -->
-    <td><a name="org.apache.logging.log4j.simplelog.[loggerName]level"/>org.apache.logging.log4j.simplelog.&lt;loggerName&gt;level</td>
+    <td><a name="org.apache.logging.log4j.simplelog.[loggerName]level"/>org.apache.logging.log4j.simplelog.&lt;loggerName&gt;.level</td>
     <td>SimpleLogger default log level</td>
     <td>Log level for a the SimpleLogger instance with the specified name.</td>
   </tr>
   <tr>
+    <td><a name="simplelogStatusLoggerLevel"/>log4j2.simplelogStatusLoggerLevel</td>
+    <td>LOG4J_SIMPLELOG_STATUS_LOGGER_LEVEL</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td><a name="org.apache.logging.log4j.simplelog.StatusLogger.level" />org.apache.logging.log4j.simplelog .StatusLogger.level</td>
     <td>ERROR</td>
@@ -1863,6 +1978,8 @@ public class AwesomeTest {
     and from that point onwards, status messages are only sent to the listeners (depending on their statusLevel).</td>
   </tr>
   <tr>
+    <td><a name="defaultStatusLevel"/>log4j2.defaultStatusLevel</td>
+    <td>LOG4J_DEFAULT_STATUS_LEVEL</td>
     <td><a name="Log4jDefaultStatusLevel" />Log4jDefaultStatusLevel</td>
     <td>ERROR</td>
     <td>
@@ -1877,6 +1994,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="statusLoggerLevel"/>log4j2.statusLoggerLevel</td>
+    <td>LOG4J_STATUS_LOGGER_LEVEL</td>
     <td><a name="log4j2.StatusLogger.level"/>log4j2.StatusLogger.level</td>
     <td>WARN</td>
     <td>
@@ -1895,6 +2014,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="statusEntries"/>log4j2.statusEntries</td>
+    <td>LOG4J_STATUS_ENTRIES</td>
     <td><a name="log4j2.status.entries"/>log4j2.status.entries</td>
     <td>200</td>
     <td>
@@ -1903,6 +2024,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerExceptionHandler"/>log4j2.asyncLoggerExceptionHandler</td>
+    <td>LOG4J_ASYNC_LOGGER_EXCEPTION_HANDLER</td>
     <td><a name="AsyncLogger.ExceptionHandler"/>AsyncLogger.ExceptionHandler</td>
     <td>default handler</td>
     <td>
@@ -1910,6 +2033,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerRingBufferSize"/>log4j2.asyncLoggerRingBufferSize</td>
+    <td>LOG4J_ASYNC_LOGGER_RING_BUFFER_SIZE</td>
     <td><a name="AsyncLogger.RingBufferSize"/>AsyncLogger.RingBufferSize</td>
     <td>256&#160;*&#160;1024</td>
     <td>
@@ -1917,6 +2042,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerWaitStrategy"/>log4j2.asyncLoggerWaitStrategy</td>
+    <td>LOG4J_ASYNC_LOGGER_WAIT_STRATEGY</td>
     <td><a name="AsyncLogger.WaitStrategy" />AsyncLogger.WaitStrategy</td>
     <td>
       Timeout
@@ -1926,6 +2053,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerThreadNameStrategy"/>log4j2.asyncLoggerThreadNameStrategy</td>
+    <td>LOG4J_ASYNC_LOGGER_THREAD_NAME_STRATEGY</td>
     <td><a name="AsyncLogger.ThreadNameStrategy"/>AsyncLogger.ThreadNameStrategy</td>
     <td>
       CACHED
@@ -1935,6 +2064,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerConfigExceptionHandler"/>log4j2.asyncLoggerConfigExceptionHandler</td>
+    <td>LOG4J_ASYNC_LOGGER_CONFIG_EXCEPTION_HANDLER</td>
     <td><a name="AsyncLoggerConfig.ExceptionHandler"/>AsyncLoggerConfig.ExceptionHandler</td>
     <td>default handler</td>
     <td>
@@ -1942,6 +2073,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerConfigRingBufferSize"/>log4j2.asyncLoggerConfigRingBufferSize</td>
+    <td>LOG4J_ASYNC_LOGGER_CONFIG_RING_BUFFER_SIZE</td>
     <td><a name="AsyncLoggerConfig.RingBufferSize"/>AsyncLoggerConfig.RingBufferSize</td>
     <td>256&#160;*&#160;1024</td>
     <td>
@@ -1949,6 +2082,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncLoggerConfigWaitStrategy"/>log4j2.asyncLoggerConfigWaitStrategy</td>
+    <td>LOG4J_ASYNC_LOGGER_CONFIG_WAIT_STRATEGY</td>
     <td><a name="AsyncLoggerConfig.WaitStrategy"/>AsyncLoggerConfig.WaitStrategy</td>
     <td>
       Timeout
@@ -1958,6 +2093,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="julLoggerAdapter"/>log4j2.julLoggerAdapter</td>
+    <td>LOG4J_JUL_LOGGER_ADAPTER</td>
     <td><a name="log4j.jul.LoggerAdapter"/>log4j.jul.LoggerAdapter</td>
     <!-- deliberately inserted spaces to allow line break -->
     <td>org.apache.logging.log4j.jul .ApiLoggerAdapter</td>
@@ -1968,6 +2105,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="formatMsgAsync"/>log4j2.formatMsgAsync</td>
+    <td>LOG4J_FORMAT_MSG_ASYNC</td>
     <td><a name="log4j.format.msg.async"/>log4j.format.msg.async</td>
     <td>
       false
@@ -1978,6 +2117,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="asyncQueueFullPolicy"/>log4j2.asyncQueueFullPolicy</td>
+    <td>LOG4J_ASYNC_QUEUE_FULL_POLICY</td>
     <td><a name="log4j2.AsyncQueueFullPolicy"/>log4j2.AsyncQueueFullPolicy</td>
     <td>&nbsp;</td>
     <td>
@@ -1990,6 +2131,8 @@ public class AwesomeTest {
     </td>
   </tr>
   <tr>
+    <td><a name="discardThreshold"/>log4j2.discardThreshold</td>
+    <td>LOG4J_DISCARD_THRESHOLD</td>
     <td><a name="log4j2.DiscardThreshold"/>log4j2.DiscardThreshold</td>
     <td>INFO</td>
     <td>Used by the DiscardingAsyncQueueFullPolicy to determine which events to drop when the queue
@@ -1999,23 +2142,31 @@ public class AwesomeTest {
       <tt>log4j2.AsyncQueueFullPolicy</tt>.</td>
   </tr>
   <tr>
+    <td><a name="messageFactory"/>log4j2.messageFactory</td>
+    <td>LOG4J_MESSAGE_FACTORY</td>
     <td><a name="log4j2.messageFactory" />log4j2.messageFactory</td>
     <td>org.apache.logging.log4j.message. ParameterizedMessageFactory or
       org.apache.logging.log4j.message. ReusableMessageFactory in garbage-free mode</td>
     <td>Default message factory used by Loggers if no factory was specified.</td>
   </tr>
   <tr>
+    <td><a name="flowMessageFactory"/>log4j2.flowMessageFactory</td>
+    <td>LOG4J_FLOW_MESSAGE_FACTORY</td>
     <td><a name="log4j2.flowMessageFactory" />log4j2.flowMessageFactory</td>
     <td>org.apache.logging.log4j.message. DefaultFlowMessageFactory</td>
     <td>Default flow message factory used by Loggers.</td>
   </tr>
   <tr>
+    <td><a name="isWebapp"/>log4j2.isWebapp</td>
+    <td>LOG4J_IS_WEBAPP</td>
     <td><a name="log4j2.is.webapp"/>log4j2.is.webapp</td>
     <td>true if <tt>Servlet</tt> class on class path </td>
     <td>This system property can be used to force Log4j 2 to behave as if it is part of a web application (when true)
     or as if it is not part of a web application (when false).</td>
   </tr>
   <tr>
+    <td><a name="enableThreadlocals"/>log4j2.enableThreadlocals</td>
+    <td>LOG4J_ENABLE_THREADLOCALS</td>
     <td><a name="log4j2.enable.threadlocals" />log4j2.enable.threadlocals</td>
     <td>true</td>
     <td>This system property can be used to switch off the use of threadlocals, which will partly disable
@@ -2024,6 +2175,8 @@ public class AwesomeTest {
       Note that this property is not effective when Log4j detects it is running in a web application.</td>
   </tr>
   <tr>
+    <td><a name="enableDirectEncoders"/>log4j2.enableDirectEncoders</td>
+    <td>LOG4J_ENABLE_DIRECT_ENCODERS</td>
     <td><a name="log4j2.enable.direct.encoders" />log4j2.enable.direct.encoders</td>
     <td>true</td>
     <td>This property can be used to force garbage-aware Layouts and Appenders to revert to the
@@ -2033,24 +2186,32 @@ public class AwesomeTest {
       to text will convert this text to bytes without creating temporary objects.</td>
   </tr>
   <tr>
+    <td><a name="initialReusableMsgSize"/>log4j2.initialReusableMsgSize</td>
+    <td>LOG4J_INITIAL_REUSABLE_MSG_SIZE</td>
     <td><a name="log4j.initialReusableMsgSize" />log4j.initialReusableMsgSize</td>
     <td>128</td>
     <td>In GC-free mode, this property determines the initial size of the reusable StringBuilders where the message
      text is formatted and potentially passed to background threads.</td>
   </tr>
   <tr>
+    <td><a name="maxReusableMsgSize"/>log4j2.maxReusableMsgSize</td>
+    <td>LOG4J_MAX_REUSABLE_MSG_SIZE</td>
     <td><a name="log4j.maxReusableMsgSize" />log4j.maxReusableMsgSize</td>
     <td>518</td>
     <td>In GC-free mode, this property determines the maximum size of the reusable StringBuilders where the message
      text is formatted and potentially passed to background threads.</td>
   </tr>
   <tr>
+    <td><a name="layoutStringBuilderMaxSize"/>log4j2.layoutStringBuilderMaxSize</td>
+    <td>LOG4J_LAYOUT_STRING_BUILDER_MAX_SIZE</td>
     <td><a name="log4j.layoutStringBuilder.maxSize" />log4j.layoutStringBuilder.maxSize</td>
     <td>2048</td>
     <td>This property determines the maximum size of the thread-local reusable StringBuilders
      used to format the log event to text by Layouts that extend AbstractStringLayout.</td>
   </tr>
   <tr>
+    <td><a name="unboxRingbufferSize"/>log4j2.unboxRingbufferSize</td>
+    <td>LOG4J_UNBOX_RINGBUFFER_SIZE</td>
     <td><a name="log4j.unbox.ringbuffer.size" />log4j.unbox.ringbuffer.size</td>
     <td>32</td>
     <td>The <tt>org.apache.logging.log4j.util.Unbox</tt> utility
@@ -2063,6 +2224,8 @@ public class AwesomeTest {
      Note that the specified number will be rounded up to the nearest power of 2.</p></td>
   </tr>
   <tr>
+    <td><a name="loggerContextStacktraceOnStart"/>log4j2.loggerContextStacktraceOnStart</td>
+    <td>LOG4J_LOGGER_CONTEXT_STACKTRACE_ON_START</td>
     <td><a name="log4j.LoggerContext.stacktrace.on.start" />log4j.LoggerContext.stacktrace.on.start</td>
     <td>false</td>
     <td>Prints a stacktrace to the <a href="#StatusMessages">status logger</a> at DEBUG level

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/customconfig.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/customconfig.xml b/src/site/xdoc/manual/customconfig.xml
index ced5cbc..8b1b8bd 100644
--- a/src/site/xdoc/manual/customconfig.xml
+++ b/src/site/xdoc/manual/customconfig.xml
@@ -78,7 +78,7 @@
               the available ConfigurationFactories:
             </p>
             <ol>
-              <li>A system property named "log4j.configurationFactory" can be set with the name of the ConfigurationFactory to be used.</li>
+              <li>A system property named <tt>log4j2.configurationFactory</tt> can be set with the name of the ConfigurationFactory to be used.</li>
               <li><code>ConfigurationFactory.setConfigurationFactory(ConfigurationFactory)</code> can be called with the instance of the
               ConfigurationFactory to be used. This must be called before any other calls to Log4j.</li>
               <li>A ConfigurationFactory implementation can be added to the classpath and configured as a plugin

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/eventlogging.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/eventlogging.xml b/src/site/xdoc/manual/eventlogging.xml
index 5bac1f2..8573499 100644
--- a/src/site/xdoc/manual/eventlogging.xml
+++ b/src/site/xdoc/manual/eventlogging.xml
@@ -100,7 +100,7 @@ public class RequestFilter implements Filter {
         }
         ThreadContext.put("hostname", servletRequest.getServerName());
         ThreadContext.put("productName", filterConfig.getInitParameter("ProductName"));
-        Threadcontext.put("locale", servletRequest.getLocale().getDisplayName());
+        ThreadContext.put("locale", servletRequest.getLocale().getDisplayName());
         if (timeZone == null) {
             timeZone = TimeZone.getDefault();
         }
@@ -137,7 +137,7 @@ public class MyApp {
             <p>The EventLogger class uses a Logger named "EventLogger". EventLogger uses a logging level
               of OFF as the default to indicate that it cannot be filtered. These events can be
               formatted for printing using the
-              <a href="../log4j-core/apidocs/org/apache/logging/log4j/core/layout/StructuredDataLayout.html">StructuredDataLayout</a>.
+              <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/layout/StructuredDataLayout.html">StructuredDataLayout</a>.
             </p>
           </subsection>
         </section>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/extending.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/extending.xml b/src/site/xdoc/manual/extending.xml
index 4362cfb..ee0dd01 100644
--- a/src/site/xdoc/manual/extending.xml
+++ b/src/site/xdoc/manual/extending.xml
@@ -55,7 +55,7 @@
                 <li>Implement a new <code>LoggerContextFactory</code>.</li>
                 <li>Implement a class that extends <code>org.apache.logging.spi.Provider.</code> with a no-arg
                   constructor that calls super-class's constructor with the <var>Priority</var>, the API version(s),
-                  <code>LoggerContextFactory</code> class, and optinall, a <code>ThreadContextMap</code>
+                  <code>LoggerContextFactory</code> class, and optionally, a <code>ThreadContextMap</code>
                   implementation class.</li>
                 <li>Create a <code>META-INF/services/org.apache.logging.spi.Provider</code> file that contains the
                   name of the class that implements <code>org.apache.logging.spi.Provider</code>.
@@ -534,7 +534,7 @@ ListAppender list2 = ListAppender.newBuilder().setName("List1").setEntryPerNewLi
             The default implementation is ThreadContextDataInjector, which obtains context attributes from the ThreadContext.
           </p><p>
           Applications may replace the default ContextDataInjector by setting the value of the system property
-          log4j2.ContextDataInjector to the name of the custom ContextDataInjector class.
+          <tt>log4j2.contextDataInjector</tt> to the name of the custom ContextDataInjector class.
         </p><p>
           Implementors should be aware there are some subtleties related to thread-safety and implementing a
           context data injector in a garbage-free manner.
@@ -544,11 +544,11 @@ ListAppender list2 = ListAppender.newBuilder().setName("List1").setEntryPerNewLi
         </subsection>
         <subsection name="Custom ThreadContextMap implementations">
           <p>
-            A garbage-free StringMap-based context map can be installed by setting system property log4j2.garbagefree.threadContextMap
+            A garbage-free StringMap-based context map can be installed by setting system property <tt>log4j2.garbagefreeThreadContextMap</tt>
             to true. (Log4j must be <a href="garbagefree.html#Config">enabled</a> to use ThreadLocals.)
           </p><p>
             Any custom <tt>ThreadContextMap</tt> implementation can be installed by setting system property
-            log4j2.threadContextMap to the fully qualified class name of the class implementing the
+            <tt>log4j2.threadContextMap</tt> to the fully qualified class name of the class implementing the
             ThreadContextMap interface. By also implementing the <tt>ReadOnlyThreadContextMap</tt> interface, your custom
             ThreadContextMap implementation will be accessible to applications via the
           <a href="../log4j-api/apidocs/org/apache/logging/log4j/ThreadContext.html#getThreadContextMap()">ThreadContext::getThreadContextMap</a>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/flowtracing.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/flowtracing.xml b/src/site/xdoc/manual/flowtracing.xml
index 666e81b..916a9bb 100644
--- a/src/site/xdoc/manual/flowtracing.xml
+++ b/src/site/xdoc/manual/flowtracing.xml
@@ -42,7 +42,7 @@
             <p>
               The most used methods are the entry() or traceEntry() and exit() or traceExit() methods. entry()
               or traceEntry() should be placed at the beginning of methods, except perhaps for simple
-              getters and setters. entry() can be calledpassing from 0 to 4 parameters. Typically these will be
+              getters and setters. entry() can be called passing from 0 to 4 parameters. Typically these will be
               parameters passed to the method. traceEntry() can be passed a format String and a variable list of
               parameters, or a Message. The entry() and traceEntry() methods log with a level of TRACE and uses
               a Marker with a name of "ENTER" which is also a "FLOW" Marker and all message strings will begin
@@ -74,7 +74,7 @@
               also an "EXCEPTION" Marker.
             </p>
             <p>
-              The following example shows a simple application using these methods in a fairly typcial manner. The
+              The following example shows a simple application using these methods in a fairly typical manner. The
               throwing() is not present since no Exceptions are explicitly thrown and not handled.
             </p>
 <pre class="prettyprint linenums">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/garbagefree.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/garbagefree.xml b/src/site/xdoc/manual/garbagefree.xml
index fe6c681..b0852bc 100644
--- a/src/site/xdoc/manual/garbagefree.xml
+++ b/src/site/xdoc/manual/garbagefree.xml
@@ -96,7 +96,7 @@
           To avoid causing memory leaks, Log4j will not use these ThreadLocals when
           it detects that it is used in a web application
           (when the <tt>javax.servlet.Servlet</tt> class is in the classpath,
-          or when system property <tt>log4j2.is.webapp</tt> is set to "true").
+          or when system property <tt>log4j2.isWebapp</tt> is set to "true").
         </p>
           <p>
             Some garbage-reducing functionality does not rely on ThreadLocals and is
@@ -124,21 +124,22 @@
             creating temporary objects:
           </p>
           <ul>
-            <li><tt>log4j2.enable.threadlocals</tt> - if "true" (the default for non-web applications)
+            <li><tt>log4j2.enableThreadlocals</tt> - if "true" (the default for non-web applications)
               objects are stored in ThreadLocal fields and reused, otherwise new
               objects are created for each log event.</li>
-            <li><tt>log4j2.enable.direct.encoders</tt> - if "true" (the default) log events are converted to text and this
+            <li><tt>log4j2.enableDirectEncoders</tt> - if "true" (the default) log events are converted to text and this
               text is converted to bytes without creating temporary objects. Note:
               <em>synchronous</em> logging performance may be worse for multi-threaded applications in this mode due to
               synchronization on the shared buffer. If your application is multi-threaded and logging performance
               is important, consider using Async Loggers.
               </li>
             <li>The ThreadContext map is <em>not</em> garbage-free by default, but from Log4j 2.7 it can be configured
-              to be garbage-free by setting system property <tt>log4j2.garbagefree.threadContextMap</tt> to "true".</li>
+              to be garbage-free by setting system property <tt>log4j2.garbagefreeThreadContextMap</tt> to "true".</li>
           </ul>
           <p>
             Instead of system properties, the above properties can also be specified in a file named
             <tt>log4j2.component.properties</tt> by including this file in the classpath of the application.
+            See the <a href="configuration.html#SystemProperties">manual regarding system properties</a> for more info.
           </p>
         <a name="Appenders" />
           <h4>Supported Appenders</h4>
@@ -410,7 +411,7 @@
           </p>
           <p>
             Log4j may call <tt>toString()</tt> on message and parameter objects when garbage-free logging
-            is disabled (when system property <tt>log4j2.enable.threadlocals</tt> is set to "false".)
+            is disabled (when system property <tt>log4j2.enableThreadlocals</tt> is set to "false".)
           </p>
         <a name="codeImpact" />
         <h4>Impact on Application Code: Autoboxing</h4>
@@ -439,7 +440,7 @@ public void garbageFree() {
             </p>
             <ul>
               <li>The ThreadContext map is not garbage-free by default, but can be configured to be garbage-free
-              by setting system property <tt>log4j2.garbagefree.threadContextMap</tt> to "true".</li>
+              by setting system property <tt>log4j2.garbagefreeThreadContextMap</tt> to "true".</li>
               <li>The ThreadContext stack is not garbage-free.</li>
               <li>Logging more than 10 parameters creates vararg arrays.</li>
               <li>Logging very large messages (more than 518 characters) when all loggers are Async Loggers

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/jmx.xml.vm
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/jmx.xml.vm b/src/site/xdoc/manual/jmx.xml.vm
index 9940d26..89eef0e 100644
--- a/src/site/xdoc/manual/jmx.xml.vm
+++ b/src/site/xdoc/manual/jmx.xml.vm
@@ -44,7 +44,7 @@
         the StatusLogger, ContextSelector, and all LoggerContexts,
           LoggerConfigs and Appenders are instrumented with MBeans.
         To disable JMX completely, and prevent these MBeans from being created,
-        specify system property <code>log4j2.disable.jmx=true</code> when you start
+        specify system property <tt>log4j2.disableJmx</tt> to <tt>true</tt> when you start
         the Java VM.
         </p>
 		<subsection name="Local Monitoring and Management">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/logsep.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/logsep.xml b/src/site/xdoc/manual/logsep.xml
index d208a6c..55b59eb 100644
--- a/src/site/xdoc/manual/logsep.xml
+++ b/src/site/xdoc/manual/logsep.xml
@@ -94,8 +94,8 @@
             </p>
               <ol>
                 <li>Place the logging jars in the container's classpath and set the system property
-                  "Log4jContextSelector" to "org.apache.logging.log4j.core.selector.BasicContextSelector". This will
-                  create a single LoggerContext using a single configuration that will be shared across all
+                  <tt>log4j2.contextSelector</tt> to <code>org.apache.logging.log4j.core.selector.BasicContextSelector</code>.
+                  This will create a single LoggerContext using a single configuration that will be shared across all
                   applications.</li>
                 <li>
                   Place the logging jars in the container's classpath and use the default ClassLoaderContextSelector.
@@ -106,7 +106,7 @@
                 </li>
                 <li>
                   Follow the <a href="webapp.html">instructions to initialize Log4j 2 in a web application</a> and set
-                  the system property or servlet context parameter <code>Log4jContextSelector</code> to
+                  the system property or servlet context parameter <tt>log4j2.contextSelector</tt> to
                   <kbd>org.apache.logging.log4j.core.selector.JndiContextSelector</kbd>. This will cause the container
                   to use JNDI to locate each web application's <code>LoggerContext</code>. Be sure to set the
                   <code>isLog4jContextSelectorNamed</code> context parameter to <kbd>true</kbd> and also set the

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/36f70030/src/site/xdoc/manual/thread-context.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/thread-context.xml b/src/site/xdoc/manual/thread-context.xml
index 35b7a96..5867c38 100644
--- a/src/site/xdoc/manual/thread-context.xml
+++ b/src/site/xdoc/manual/thread-context.xml
@@ -155,7 +155,7 @@ for( final Session session : sessions ) {
             <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html">ThreadLocal</a>
             by default. The Map can be configured to use an
             <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/InheritableThreadLocal.html">InheritableThreadLocal</a>
-            by setting system property <tt>isThreadContextMapInheritable</tt> to <tt>"true"</tt>.
+            by setting system property <tt>log4j2.isThreadContextMapInheritable</tt> to <tt>true</tt>.
             When configured this way, the contents of the Map will be passed to child threads. However, as
             discussed in the
             <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#privilegedThreadFactory()">Executors</a>


[15/15] logging-log4j2 git commit: Prevent potential NPE when the os.name property cannot be accessed

Posted by ma...@apache.org.
Prevent potential NPE when the os.name property cannot be accessed


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9b8a17f4
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9b8a17f4
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9b8a17f4

Branch: refs/heads/master
Commit: 9b8a17f4c4d9e2f157412fc2f2ea773064b77c8e
Parents: 31f68af
Author: Matt Sicker <bo...@gmail.com>
Authored: Sat Oct 14 12:11:28 2017 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Sat Oct 14 12:11:28 2017 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/util/PropertiesUtil.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9b8a17f4/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 472088d..f5e1ecb 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -434,7 +434,7 @@ public final class PropertiesUtil {
      * @return true if system properties tell us we are running on Windows.
      */
     public boolean isOsWindows() {
-        return getStringProperty("os.name").startsWith("Windows");
+        return getStringProperty("os.name", "").startsWith("Windows");
     }
 
 }


[08/15] logging-log4j2 git commit: Improve javadocs

Posted by ma...@apache.org.
Improve javadocs


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/bf06bb25
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/bf06bb25
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/bf06bb25

Branch: refs/heads/master
Commit: bf06bb253e030d7d4b7fb0bf782438b3b232139e
Parents: 44254d2
Author: Matt Sicker <bo...@gmail.com>
Authored: Sun Feb 5 15:39:47 2017 -0600
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../org/apache/logging/log4j/util/PropertiesUtil.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bf06bb25/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 46f3344..6acf707 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -33,13 +33,19 @@ import java.util.concurrent.ConcurrentHashMap;
 /**
  * <em>Consider this class private.</em>
  * <p>
- * Helps access properties. This utility provides a method to override system properties by specifying properties in a
- * properties file.
+ * Provides utility methods for managing {@link Properties} instances as well as access to the global configuration
+ * system. Properties by default are loaded from the system properties, system environment, and a classpath resource
+ * file named {@value #LOG4J_PROPERTIES_FILE_NAME}. Additional properties can be loaded by implementing a custom
+ * {@link PropertySource} service and specifying it via a {@link ServiceLoader} file called
+ * {@code META-INF/services/org.apache.logging.log4j.util.PropertySource} with a list of fully qualified class names
+ * implementing that interface.
  * </p>
+ * @see PropertySource
  */
 public final class PropertiesUtil {
 
-    private static final PropertiesUtil LOG4J_PROPERTIES = new PropertiesUtil("log4j2.component.properties");
+    private static final String LOG4J_PROPERTIES_FILE_NAME = "log4j2.component.properties";
+    private static final PropertiesUtil LOG4J_PROPERTIES = new PropertiesUtil(LOG4J_PROPERTIES_FILE_NAME);
 
     private final Environment environment;
 


[06/15] logging-log4j2 git commit: Add PropertiesUtil.Environment.containsKey

Posted by ma...@apache.org.
Add PropertiesUtil.Environment.containsKey


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a010a2af
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a010a2af
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a010a2af

Branch: refs/heads/master
Commit: a010a2af3dfeabab64db24d5575cb764127c01c5
Parents: 3efa9d4
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 14:27:18 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../logging/log4j/util/PropertiesUtil.java      | 29 ++++++++++++++------
 1 file changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a010a2af/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 6acf707..d8679ac 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -108,7 +108,7 @@ public final class PropertiesUtil {
      * @return {@code true} if the specified property is defined, regardless of its value
      */
     public boolean hasProperty(final String name) {
-        return System.getProperties().containsKey(name) || props.containsKey(name);
+        return environment.containsKey(name);
     }
 
     /**
@@ -282,6 +282,8 @@ public final class PropertiesUtil {
      * Legacy: the original property name as defined in the source pre-2.9.
      *
      * Tokenized: loose matching based on word boundaries.
+     *
+     * @since 2.9
      */
     private static class Environment {
 
@@ -312,6 +314,14 @@ public final class PropertiesUtil {
             }
         }
 
+        private static boolean hasSystemProperty(final String key) {
+            try {
+                return System.getProperties().containsKey(key);
+            } catch (final SecurityException ignored) {
+                return false;
+            }
+        }
+
         private String get(final String key) {
             if (normalized.containsKey(key)) {
                 return normalized.get(key);
@@ -319,17 +329,18 @@ public final class PropertiesUtil {
             if (literal.containsKey(key)) {
                 return literal.get(key);
             }
-            String prop = null;
-            try {
-                prop = System.getProperty(key);
-            } catch (final SecurityException ignored) {
-                // Ignore
-            }
-            if (prop != null) {
-                return prop;
+            if (hasSystemProperty(key)) {
+                return System.getProperty(key);
             }
             return tokenized.get(PropertySource.Util.tokenize(key));
         }
+
+        private boolean containsKey(final String key) {
+            return normalized.containsKey(key) ||
+                literal.containsKey(key) ||
+                hasSystemProperty(key) ||
+                tokenized.containsKey(PropertySource.Util.tokenize(key));
+        }
     }
 
     /**


[13/15] logging-log4j2 git commit: Merge branch 'LOG4J2-1431' and fix version numbers

Posted by ma...@apache.org.
Merge branch 'LOG4J2-1431' and fix version numbers

# Conflicts:
#	log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
#	src/changes/changes.xml


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/06dcce45
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/06dcce45
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/06dcce45

Branch: refs/heads/master
Commit: 06dcce455c0409f47e808fbf837a136f140e18de
Parents: 1357d4c d1a9ecf
Author: Matt Sicker <bo...@gmail.com>
Authored: Sat Oct 14 12:09:29 2017 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Sat Oct 14 12:09:29 2017 -0500

----------------------------------------------------------------------
 .../log4j/util/EnvironmentPropertySource.java   |  55 +++++
 .../log4j/util/PropertiesPropertySource.java    |  54 +++++
 .../logging/log4j/util/PropertiesUtil.java      | 215 ++++++++++++-------
 .../log4j/util/PropertyFilePropertySource.java  |  52 +++++
 .../logging/log4j/util/PropertySource.java      | 131 +++++++++++
 .../util/SystemPropertiesPropertySource.java    |  48 +++++
 ...org.apache.logging.log4j.util.PropertySource |  16 ++
 .../util/EnvironmentPropertySourceTest.java     |  58 +++++
 .../util/LegacyPropertiesCompatibilityTest.java | 103 +++++++++
 .../util/PropertiesPropertySourceTest.java      |  59 +++++
 .../log4j/util/PropertySourceCamelCaseTest.java |  57 +++++
 .../log4j/util/PropertySourceTokenizerTest.java |  69 ++++++
 .../db/jpa/AbstractJpaAppenderTest.java         |   3 +
 .../AbstractAsyncThreadContextTestBase.java     |   2 +
 .../async/AsyncQueueFullPolicyFactoryTest.java  |  14 +-
 .../log4j/core/util/ClockFactoryTest.java       |  12 +-
 src/changes/changes.xml                         |   8 +-
 src/site/xdoc/manual/async.xml                  |  46 ++--
 src/site/xdoc/manual/configuration.xml.vm       | 187 ++++++++++++++--
 src/site/xdoc/manual/customconfig.xml           |   2 +-
 src/site/xdoc/manual/eventlogging.xml           |   4 +-
 src/site/xdoc/manual/extending.xml              |   8 +-
 src/site/xdoc/manual/flowtracing.xml            |   4 +-
 src/site/xdoc/manual/garbagefree.xml            |  13 +-
 src/site/xdoc/manual/jmx.xml.vm                 |   2 +-
 src/site/xdoc/manual/logsep.xml                 |   6 +-
 src/site/xdoc/manual/thread-context.xml         |   2 +-
 27 files changed, 1081 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06dcce45/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --cc log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 85ee9d6,45438d2..d5918c0
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@@ -25,7 -25,9 +26,10 @@@ import java.util.Collections
  import java.util.List;
  import java.util.Map;
  import java.util.Properties;
+ import java.util.ServiceLoader;
+ import java.util.Set;
+ import java.util.TreeSet;
 +import java.util.ResourceBundle;
  import java.util.concurrent.ConcurrentHashMap;
  
  /**
@@@ -174,13 -161,10 +163,11 @@@ public final class PropertiesUtil 
      }
  
      /**
 -     * Gets the named property as a Charset value.
 +     * Gets the named property as a Charset value. If we cannot find the named Charset, see if it is mapped in
 +     * file {@code Log4j-charsets.properties} on the class path.
       *
-      * @param name
-      *            the name of the property to look up
-      * @param defaultValue
-      *            the default value to use if the property is undefined
+      * @param name the name of the property to look up
+      * @param defaultValue the default value to use if the property is undefined
       * @return the Charset value of the property or {@code defaultValue} if undefined.
       */
      public Charset getCharsetProperty(final String name, final Charset defaultValue) {
@@@ -375,7 -413,6 +430,7 @@@
  
      /**
       * Returns true if system properties tell us we are running on Windows.
-      * 
++     *
       * @return true if system properties tell us we are running on Windows.
       */
      public boolean isOsWindows() {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06dcce45/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractJpaAppenderTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06dcce45/src/changes/changes.xml
----------------------------------------------------------------------
diff --cc src/changes/changes.xml
index fee081e,b20527f..e77e9c8
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@@ -30,106 -30,13 +30,112 @@@
           - "update" - Change
           - "remove" - Removed
      -->
 -    <release version="2.9.1" date="2017-??-??" description="GA Release 2.9.1">
 +    <release version="2.10.0" date="2017-MM-DD" description="GA Release 2.10.0">
+       <action issue="LOG4J2-1431" dev="mattsicker" type="add">
+         Simplify log4j system property naming scheme.
+       </action>
+       <action issue="LOG4J2-1809" dev="mattsicker" type="add">
+         Add global configuration environment SPI.
+       </action>
 +      <action issue="LOG4J2-2025" dev="rgoers" type="update">
 +        Provide support for overriding the Tomcat Log class in Tomcat 8.5+.
 +      </action>
 +      <action issue="LOG4J2-1694" dev="mikes" type="add" due-to="Michal Dvořák">
 +        Add fields with fixed values to JSON/XML/YAML layouts.
 +      </action>
 +      <action issue="LOG4J2-2054" dev="rpopma" type="add">
 +      Provide ways to configure SSL that avoid plain-text passwords in the log4j configuration. The configuration may
 +        now specify a system environment variable that holds the password, or the path to a file that holds the password.
 +      </action>
 +      <action issue="LOG4J2-2057" dev="rgoers" type="update">
 +        Support new SLF4J binding mechanism introduced in SLF4J 1.8.
 +      </action>
 +      <action issue="LOG4J2-2052" dev="rpopma" type="update">
 +        Disable thread name caching by default when running on Java 8u102 or later.
 +      </action>
 +      <action issue="LOG4J2-2055" dev="rgoers" type="fix">
 +        If Log4j is used as the Tomcat logging implementation startup might fail if an application also uses Log4j.
 +      </action>
 +      <action issue="LOG4J2-1896" dev="rpopma" type="update">
 +        Update classes in org.apache.logging.log4j.core.net.ssl in APIs from String to a PasswordProvider producing
 +        char[] for passwords.
 +      </action>
 +      <action issue="LOG4J2-2031" dev="rpopma" type="fix">
 +        Until this change, messages appeared out of order in log file any time when the async logging queue was full.
 +        With this change, messages are only logged out of order to prevent deadlock when Log4j2 detects recursive
 +        logging while the queue is full.
 +      </action>
 +      <action issue="LOG4J2-2053" dev="ggregory" type="fix">
 +        Exception java.nio.charset.UnsupportedCharsetException: cp65001 in 2.9.0.
 +      </action>
 +      <action issue="LOG4J2-1216" dev="ggregory" type="fix" due-to="Thies Wellpott, Barna Zsombor Klara, GFriedrich">
 +        Nested pattern layout options broken.
 +      </action>
 +      <action issue="LOG4J2-2070" dev="ggregory" type="fix" due-to="Doug Hughes">
 +        Log4j1XmlLayout does not provide the entire stack trace, it is missing the caused by information.
 +      </action>
 +      <action issue="LOG4J2-2036" dev="ggregory" type="fix" due-to="Robert Haycock">
 +        CompositeConfiguration supports Reconfiguration. PR #115.
 +      </action>
 +      <action issue="LOG4J2-2071" dev="ggregory" type="add" due-to="Carter Kozak">
 +        Add org.apache.logging.log4j.core.config.composite.CompositeConfiguration#toString().
 +      </action>
 +      <action issue="LOG4J2-2073" dev="ggregory" type="fix" due-to="Patrick Lucas">
 +        Log4j-config.xsd should make AppenderRef optional for each Logger element.
 +      </action>
 +      <action issue="LOG4J2-2074" dev="ggregory" type="fix">
 +        The console appender should say why it cannot load JAnsi.
 +      </action>
 +    </release>
 +    <release version="2.9.1" date="2017-09-17" description="GA Release 2.9.1">
 +      <action issue="LOG4J2-1988" dev="rpopma" type="fix">
 +        Prevent ConcurrentModificationException with AsyncLoggerConfig.
 +      </action>
 +      <action issue="LOG4J2-1914" dev="rpopma" type="fix">
 +        Prevent ConcurrentModificationException with AsyncLoggerConfig.
 +      </action>
 +      <action issue="LOG4J2-2048" dev="rpopma" type="fix">
 +        Increase default queue size for AsyncAppender from 128 to 1024.
 +      </action>
 +      <action issue="LOG4J2-2035" dev="rpopma" type="fix">
 +        Fix documentation to clarify disruptor-3.3.4 is now required for async loggers (previously the docs referred to disruptor-3.3.3 which was never released).
 +      </action>
 +      <action issue="LOG4J2-2030" dev="rgoers" type="fix">
 +        Inspect all known ClassLoaders to locate the service provider.
 +      </action>
 +      <action issue="LOG4J2-2028" dev="rgoers" type="fix" due-to="Jason Tedor">
 +        Java 9 StackLocator was not properly skipping the initial stack frames.
 +      </action>
 +      <action issue="LOG4J2-2023" dev="ggregory" type="update">
 +        Use a class' canonical name instead of name to create its logger name.
 +      </action>
 +      <action issue="LOG4J2-2026" dev="ggregory" type="fix" due-to="Leon Finker">
 +        java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature().
 +      </action>
 +      <action issue="LOG4J2-2029" dev="ggregory" type="fix" due-to="Fabrizio Cucci">
 +        Marker examples should not use deprecated flow APIs.
 +      </action>
 +      <action issue="LOG4J2-1936" dev="ggregory" type="fix" due-to="Helber Belmiro">
 +        ClassNotFoundException when making all loggers asynchronous under OSGi environment.
 +      </action>
 +      <action issue="LOG4J2-2043" dev="ggregory" type="update">
 +        Update Jackson from 2.9.0 to 2.9.1 (fix for Java 9.)
 +      </action>
 +      <action issue="LOG4J2-2044" dev="ggregory" type="update">
 +        Update Apache Commons CSV from 1.4 to 1.5.
 +      </action>
 +      <action issue="LOG4J2-2045" dev="ggregory" type="update">
 +        Update javax.mail from 1.5.6 to 1.6.0.
 +      </action>
 +      <action issue="LOG4J2-2046" dev="ggregory" type="update">
 +        Update Apache Commons Compress from 1.13 to 1.14.
 +      </action>
 +      <action issue="LOG4J2-2047" dev="ggregory" type="update">
 +        Update Cassandra driver from 3.1.0 to 3.1.4.
 +      </action>
 +      <action issue="LOG4J2-2049" dev="ggregory" type="update">
 +        Update Apache Kafka Client from 0.11.0.0 to 0.11.0.1.
 +      </action>
      </release>
      <release version="2.9.0" date="2017-08-26" description="GA Release 2.9.0">
        <action issue="LOG4J2-1928" dev="rgoers" type="update">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06dcce45/src/site/xdoc/manual/async.xml
----------------------------------------------------------------------


[04/15] logging-log4j2 git commit: [LOG4J2-1431]: Provide support for simplified global configuration environment

Posted by ma...@apache.org.
[LOG4J2-1431]: Provide support for simplified global configuration environment

This provides the base support for implementing simplified property names along with environment variable support.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/6744c8c9
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/6744c8c9
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/6744c8c9

Branch: refs/heads/master
Commit: 6744c8c9172667e0473bb8ac0c755f1d85986903
Parents: 17e7053
Author: Matt Sicker <bo...@gmail.com>
Authored: Sat Feb 4 03:12:58 2017 -0600
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../logging/log4j/util/PropertiesUtil.java      | 138 +++++++++++++++++--
 1 file changed, 128 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6744c8c9/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index 66270a5..b760076 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -26,6 +26,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * <em>Consider this class private.</em>
@@ -38,7 +40,7 @@ public final class PropertiesUtil {
 
     private static final PropertiesUtil LOG4J_PROPERTIES = new PropertiesUtil("log4j2.component.properties");
 
-    private final Properties props;
+    private final Environment environment;
 
     /**
      * Constructs a PropertiesUtil using a given Properties object as its source of defined properties.
@@ -46,7 +48,7 @@ public final class PropertiesUtil {
      * @param props the Properties to use by default
      */
     public PropertiesUtil(final Properties props) {
-        this.props = props;
+        this.environment = new Environment(props);
     }
 
     /**
@@ -64,7 +66,7 @@ public final class PropertiesUtil {
                 LowLevelLogUtil.logException("Unable to read " + url.toString(), ioe);
             }
         }
-        this.props = properties;
+        this.environment = new Environment(properties);
     }
 
     /**
@@ -241,13 +243,7 @@ public final class PropertiesUtil {
      * @return the String value of the property or {@code null} if undefined.
      */
     public String getStringProperty(final String name) {
-        String prop = null;
-        try {
-            prop = System.getProperty(name);
-        } catch (final SecurityException ignored) {
-            // Ignore
-        }
-        return prop == null ? props.getProperty(name) : prop;
+        return environment.get(name);
     }
 
     /**
@@ -278,6 +274,128 @@ public final class PropertiesUtil {
     }
 
     /**
+     * Provides support for looking up global configuration properties via environment variables, property files,
+     * and system properties, in three variations:
+     *
+     * Normalized: all log4j-related prefixes removed, remaining property is camelCased with a log4j2 prefix for
+     * property files and system properties, or follows a LOG4J_FOO_BAR format for environment variables.
+     *
+     * Legacy: the original property name as defined in the source pre-2.9.
+     *
+     * Tokenized: loose matching based on word boundaries.
+     */
+    private static class Environment {
+
+        private static final String NORMALIZED_PREFIX = "log4j2.";
+        private static final String PREFIXES = "(?:[Ll]og4j2?|org\\.apache\\.logging\\.log4j\\.)?";
+        private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+)[-._/]?");
+
+        private final Map<String, String> literal = new ConcurrentHashMap<>();
+        private final Map<String, String> normalized = new ConcurrentHashMap<>();
+        private final Map<List<CharSequence>, String> tokenized = new ConcurrentHashMap<>();
+
+        private Environment(final Properties props) {
+            for (final Map.Entry<String, String> entry : System.getenv().entrySet()) {
+                final String envKey = entry.getKey();
+                final String value = entry.getValue();
+                if (envKey.startsWith("LOG4J_")) {
+                    final String key = envKey.substring(6);
+                    literal.put(key, value);
+                    final List<CharSequence> tokens = tokenize(envKey);
+                    if (!tokens.isEmpty()) {
+                        tokenized.put(tokens, value);
+                        normalized.put("LOG4J" + joinAsAllCapsUnderscored(tokens), value);
+                    }
+                }
+            }
+            for (final Map.Entry<Object, Object> entry : props.entrySet()) {
+                final String key = (String) entry.getKey();
+                final String value = (String) entry.getValue();
+                literal.put(key, value);
+                final List<CharSequence> tokens = tokenize(key);
+                if (tokens.isEmpty()) {
+                    normalized.put(NORMALIZED_PREFIX + key, value);
+                } else {
+                    tokenized.put(tokens, value);
+                    normalized.put(NORMALIZED_PREFIX + joinAsCamelCase(tokens), value);
+                }
+
+            }
+            final Properties systemProperties = getSystemProperties();
+            for (Map.Entry<Object, Object> entry : systemProperties.entrySet()) {
+                final String key = (String) entry.getKey();
+                final String value = (String) entry.getValue();
+                literal.put(key, value);
+                // TODO: should this include tokenized lookups? could get screwy
+                final List<CharSequence> tokens = tokenize(key);
+                if (tokens.isEmpty()) {
+                    normalized.put(NORMALIZED_PREFIX + key, value);
+                } else {
+                    tokenized.put(tokens, value);
+                    normalized.put(NORMALIZED_PREFIX + joinAsCamelCase(tokens), value);
+                }
+            }
+        }
+
+        private static CharSequence joinAsAllCapsUnderscored(final List<CharSequence> tokens) {
+            final StringBuilder sb = new StringBuilder();
+            for (final CharSequence token : tokens) {
+                sb.append('_');
+                for (int i = 0; i < token.length(); i++) {
+                    sb.append(Character.toUpperCase(token.charAt(i)));
+                }
+            }
+            return sb.toString();
+        }
+
+        private static CharSequence joinAsCamelCase(final List<CharSequence> tokens) {
+            final StringBuilder sb = new StringBuilder();
+            boolean first = true;
+            for (final CharSequence token : tokens) {
+                if (first) {
+                    sb.append(token);
+                } else {
+                    sb.append(Character.toUpperCase(token.charAt(0)));
+                    if (token.length() > 1) {
+                        sb.append(token.subSequence(1, token.length()));
+                    }
+                }
+                first = false;
+            }
+            return sb.toString();
+        }
+
+        private static List<CharSequence> tokenize(final CharSequence value) {
+            // TODO: cache?
+            List<CharSequence> tokens = new ArrayList<>();
+            final Matcher matcher = PROPERTY_TOKENIZER.matcher(value);
+            while (matcher.find()) {
+                tokens.add(matcher.group(1).toLowerCase());
+            }
+            return tokens;
+        }
+
+        private String get(final String key) {
+            if (normalized.containsKey(key)) {
+                return normalized.get(key);
+            }
+            if (literal.containsKey(key)) {
+                return literal.get(key);
+            }
+            String prop = null;
+            try {
+                prop = System.getProperty(key);
+            } catch (final SecurityException ignored) {
+                // Ignore
+            }
+            if (prop != null) {
+                return prop;
+            }
+            return tokenized.get(tokenize(key));
+        }
+    }
+
+    /**
      * Extracts properties that start with or are equals to the specific prefix and returns them in a new Properties
      * object with the prefix removed.
      *


[14/15] logging-log4j2 git commit: Fix version number for recent API additions

Posted by ma...@apache.org.
Fix version number for recent API additions


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/31f68af8
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/31f68af8
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/31f68af8

Branch: refs/heads/master
Commit: 31f68af86c503862230514d67c18a7a6616312c7
Parents: 06dcce4
Author: Matt Sicker <bo...@gmail.com>
Authored: Sat Oct 14 12:10:59 2017 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Sat Oct 14 12:10:59 2017 -0500

----------------------------------------------------------------------
 .../log4j/util/EnvironmentPropertySource.java   |  2 +-
 .../log4j/util/PropertiesPropertySource.java    |  2 +-
 .../logging/log4j/util/PropertiesUtil.java      | 46 ++++++++++----------
 .../log4j/util/PropertyFilePropertySource.java  |  2 +-
 .../logging/log4j/util/PropertySource.java      |  6 +--
 .../util/SystemPropertiesPropertySource.java    |  2 +-
 .../util/PropertiesPropertySourceTest.java      |  3 --
 .../log4j/util/PropertySourceCamelCaseTest.java |  3 --
 .../log4j/util/PropertySourceTokenizerTest.java |  3 --
 src/site/xdoc/manual/async.xml                  |  4 +-
 src/site/xdoc/manual/configuration.xml.vm       |  4 +-
 11 files changed, 34 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
index 03cdb7f..af8c23e 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
@@ -23,7 +23,7 @@ import java.util.Map;
  * with {@code LOG4J_} so as not to conflict with other variables. Normalized environment variables follow a scheme
  * like this: {@code log4j2.fooBarProperty} would normalize to {@code LOG4J_FOO_BAR_PROPERTY}.
  *
- * @since 2.9.1
+ * @since 2.10.0
  */
 public class EnvironmentPropertySource implements PropertySource {
     @Override

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
index 80777a6..6f3e8f4 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
@@ -23,7 +23,7 @@ import java.util.Properties;
  * PropertySource backed by a {@link Properties} instance. Normalized property names follow a scheme like this:
  * {@code Log4jContextSelector} would normalize to {@code log4j2.contextSelector}.
  *
- * @since 2.9.1
+ * @since 2.10.0
  */
 public class PropertiesPropertySource implements PropertySource {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index d5918c0..472088d 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -18,18 +18,16 @@ package org.apache.logging.log4j.util;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.nio.charset.Charset;
-import java.nio.charset.UnsupportedCharsetException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.ResourceBundle;
 import java.util.ServiceLoader;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.ResourceBundle;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -42,6 +40,7 @@ import java.util.concurrent.ConcurrentHashMap;
  * {@code META-INF/services/org.apache.logging.log4j.util.PropertySource} with a list of fully qualified class names
  * implementing that interface.
  * </p>
+ *
  * @see PropertySource
  */
 public final class PropertiesUtil {
@@ -73,7 +72,7 @@ public final class PropertiesUtil {
     /**
      * Loads and closes the given property input stream. If an error occurs, log to the status logger.
      *
-     * @param in a property input stream.
+     * @param in     a property input stream.
      * @param source a source object describing the source, like a resource string or a URL.
      * @return a new Properties object
      */
@@ -106,6 +105,7 @@ public final class PropertiesUtil {
 
     /**
      * Returns {@code true} if the specified property is defined, regardless of its value (it may not have a value).
+     *
      * @param name the name of the property to verify
      * @return {@code true} if the specified property is defined, regardless of its value
      */
@@ -128,7 +128,7 @@ public final class PropertiesUtil {
     /**
      * Gets the named property as a boolean value.
      *
-     * @param name the name of the property to look up
+     * @param name         the name of the property to look up
      * @param defaultValue the default value to use if the property is undefined
      * @return the boolean value of the property or {@code defaultValue} if undefined.
      */
@@ -140,16 +140,16 @@ public final class PropertiesUtil {
     /**
      * Gets the named property as a boolean value.
      *
-     * @param name the name of the property to look up
-     * @param defaultValueIfAbsent the default value to use if the property is undefined
+     * @param name                  the name of the property to look up
+     * @param defaultValueIfAbsent  the default value to use if the property is undefined
      * @param defaultValueIfPresent the default value to use if the property is defined but not assigned
      * @return the boolean value of the property or {@code defaultValue} if undefined.
      */
     public boolean getBooleanProperty(final String name, final boolean defaultValueIfAbsent,
-            final boolean defaultValueIfPresent) {
+                                      final boolean defaultValueIfPresent) {
         final String prop = getStringProperty(name);
         return prop == null ? defaultValueIfAbsent
-                : prop.isEmpty() ? defaultValueIfPresent : "true".equalsIgnoreCase(prop);
+            : prop.isEmpty() ? defaultValueIfPresent : "true".equalsIgnoreCase(prop);
     }
 
     /**
@@ -166,7 +166,7 @@ public final class PropertiesUtil {
      * Gets the named property as a Charset value. If we cannot find the named Charset, see if it is mapped in
      * file {@code Log4j-charsets.properties} on the class path.
      *
-     * @param name the name of the property to look up
+     * @param name         the name of the property to look up
      * @param defaultValue the default value to use if the property is undefined
      * @return the Charset value of the property or {@code defaultValue} if undefined.
      */
@@ -186,14 +186,14 @@ public final class PropertiesUtil {
             }
         }
         LowLevelLogUtil.log("Unable to get Charset '" + charsetName + "' for property '" + name + "', using default "
-                + defaultValue + " and continuing.");
+            + defaultValue + " and continuing.");
         return defaultValue;
     }
 
     /**
      * Gets the named property as a double.
      *
-     * @param name the name of the property to look up
+     * @param name         the name of the property to look up
      * @param defaultValue the default value to use if the property is undefined
      * @return the parsed double value of the property or {@code defaultValue} if it was undefined or could not be parsed.
      */
@@ -212,10 +212,10 @@ public final class PropertiesUtil {
     /**
      * Gets the named property as an integer.
      *
-     * @param name the name of the property to look up
+     * @param name         the name of the property to look up
      * @param defaultValue the default value to use if the property is undefined
      * @return the parsed integer value of the property or {@code defaultValue} if it was undefined or could not be
-     *         parsed.
+     * parsed.
      */
     public int getIntegerProperty(final String name, final int defaultValue) {
         final String prop = getStringProperty(name);
@@ -232,7 +232,7 @@ public final class PropertiesUtil {
     /**
      * Gets the named property as a long.
      *
-     * @param name the name of the property to look up
+     * @param name         the name of the property to look up
      * @param defaultValue the default value to use if the property is undefined
      * @return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be parsed.
      */
@@ -261,7 +261,7 @@ public final class PropertiesUtil {
     /**
      * Gets the named property as a String.
      *
-     * @param name the name of the property to look up
+     * @param name         the name of the property to look up
      * @param defaultValue the default value to use if the property is undefined
      * @return the String value of the property or {@code defaultValue} if undefined.
      */
@@ -288,7 +288,7 @@ public final class PropertiesUtil {
     /**
      * Reloads all properties. This is primarily useful for unit tests.
      *
-     * @since 2.9.1
+     * @since 2.10.0
      */
     public void reload() {
         environment.reload();
@@ -297,15 +297,15 @@ public final class PropertiesUtil {
     /**
      * Provides support for looking up global configuration properties via environment variables, property files,
      * and system properties, in three variations:
-     *
+     * <p>
      * Normalized: all log4j-related prefixes removed, remaining property is camelCased with a log4j2 prefix for
      * property files and system properties, or follows a LOG4J_FOO_BAR format for environment variables.
-     *
-     * Legacy: the original property name as defined in the source pre-2.9.
-     *
+     * <p>
+     * Legacy: the original property name as defined in the source pre-2.10.0.
+     * <p>
      * Tokenized: loose matching based on word boundaries.
      *
-     * @since 2.9.1
+     * @since 2.10.0
      */
     private static class Environment {
 
@@ -377,7 +377,7 @@ public final class PropertiesUtil {
      * object with the prefix removed.
      *
      * @param properties The Properties to evaluate.
-     * @param prefix The prefix to extract.
+     * @param prefix     The prefix to extract.
      * @return The subset of properties.
      */
     public static Properties extractSubset(final Properties properties, final String prefix) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
index 5b11718..3adbb24 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
@@ -24,7 +24,7 @@ import java.util.Properties;
 /**
  * PropertySource backed by a properties file. Follows the same conventions as {@link PropertiesPropertySource}.
  *
- * @since 2.9.1
+ * @since 2.10.0
  */
 public class PropertyFilePropertySource extends PropertiesPropertySource {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
index c334879..75399d9 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
 /**
  * A source for global configuration properties.
  *
- * @since 2.9.1
+ * @since 2.10.0
  */
 public interface PropertySource {
 
@@ -59,7 +59,7 @@ public interface PropertySource {
     /**
      * Comparator for ordering PropertySource instances by priority.
      *
-     * @since 2.9.1
+     * @since 2.10.0
      */
     class Comparator implements java.util.Comparator<PropertySource>, Serializable {
         private static final long serialVersionUID = 1L;
@@ -73,7 +73,7 @@ public interface PropertySource {
     /**
      * Utility methods useful for PropertySource implementations.
      *
-     * @since 2.9.1
+     * @since 2.10.0
      */
     final class Util {
         private static final String PREFIXES = "(?i:^log4j2?[-._/]?|^org\\.apache\\.logging\\.log4j\\.)?";

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
index 290a604..af10fb0 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
@@ -22,7 +22,7 @@ import java.util.Map;
  * PropertySource backed by the current system properties. Other than having a higher priority over normal properties,
  * this follows the same rules as {@link PropertiesPropertySource}.
  *
- * @since 2.9.1
+ * @since 2.10.0
  */
 public class SystemPropertiesPropertySource implements PropertySource {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
index 2f07972..c1c97ef 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertiesPropertySourceTest.java
@@ -27,9 +27,6 @@ import org.junit.runners.Parameterized;
 
 import static org.junit.Assert.assertEquals;
 
-/**
- *
- */
 @RunWith(Parameterized.class)
 public class PropertiesPropertySourceTest {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
index c746199..a197085 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceCamelCaseTest.java
@@ -26,9 +26,6 @@ import org.junit.runners.Parameterized;
 
 import static org.junit.Assert.assertEquals;
 
-/**
- *
- */
 @RunWith(Parameterized.class)
 public class PropertySourceCamelCaseTest {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
index 3b25af7..dd1d49c 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/PropertySourceTokenizerTest.java
@@ -26,9 +26,6 @@ import org.junit.runners.Parameterized;
 
 import static org.junit.Assert.assertEquals;
 
-/**
- *
- */
 @RunWith(Parameterized.class)
 public class PropertySourceTokenizerTest {
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/src/site/xdoc/manual/async.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/async.xml b/src/site/xdoc/manual/async.xml
index 80cbcdb..48340b6 100644
--- a/src/site/xdoc/manual/async.xml
+++ b/src/site/xdoc/manual/async.xml
@@ -184,7 +184,7 @@
           <tt>log4j2.component.properties</tt> and including this file in the classpath of the application.
         </p>
         <p>
-          Note that system properties were renamed into a more consistent style in Log4j 2.9.1. All old property
+          Note that system properties were renamed into a more consistent style in Log4j 2.10.0. All old property
           names are still supported which are documented <a href="configuration.html#SystemProperties">here</a>.
         </p>
         <a name="SysPropsAllAsync" />
@@ -365,7 +365,7 @@
           <tt>log4j2.component.properties</tt> and including this file in the classpath of the application.
         </p>
         <p>
-          Note that system properties were renamed into a more consistent style in Log4j 2.9.1. All old property
+          Note that system properties were renamed into a more consistent style in Log4j 2.10. All old property
           names are still supported which are documented <a href="configuration.html#SystemProperties">here</a>.
         </p>
         <a name="SysPropsMixedSync-Async" />

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31f68af8/src/site/xdoc/manual/configuration.xml.vm
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/configuration.xml.vm b/src/site/xdoc/manual/configuration.xml.vm
index e7b1e12..09e7ebc 100644
--- a/src/site/xdoc/manual/configuration.xml.vm
+++ b/src/site/xdoc/manual/configuration.xml.vm
@@ -1571,7 +1571,7 @@ public class AwesomeTest {
           Any spaces present in the property name are for visual flow and should be removed.
         </p>
           <p>
-            Note that beginning in Log4j 2.9.1, all system property names have been normalized to follow a consistent
+            Note that beginning in Log4j 2.10, all system property names have been normalized to follow a consistent
             naming scheme. While the old property names are still supported for backwards compatibility, it is
             recommended to update configurations to use the new style. This system is extensible and is enabled
             through the
@@ -1621,7 +1621,7 @@ public class AwesomeTest {
             The following is a list of available global configuration properties. Note that these can only be set once
             per JVM process unlike configuration settings available in configuration files. The <i>Property Name</i>
             column contains the name used in properties files and system properties; <i>Environemt Variable</i>
-            for the equivalent environment variable; and <i>Legacy Property Name</i> for the pre-2.9.1 name.
+            for the equivalent environment variable; and <i>Legacy Property Name</i> for the pre-2.10 name.
           </p>
 <table>
   <caption align="top">Log4j 2 global configuration properties</caption>


[03/15] logging-log4j2 git commit: [LOG4J2-1809]: Add global configuration environment SPI

Posted by ma...@apache.org.
[LOG4J2-1809]: Add global configuration environment SPI

This adds a PropertySource service provider interface for providing
global configuration properties. This also refactors support in
LOG4J2-1431 to use these PropertySource providers.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d777b6f5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d777b6f5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d777b6f5

Branch: refs/heads/master
Commit: d777b6f559de7c9052a9bef77909df0a0f25fa29
Parents: 6744c8c
Author: Matt Sicker <bo...@gmail.com>
Authored: Sun Feb 5 12:45:19 2017 -0600
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:56 2017 -0500

----------------------------------------------------------------------
 .../log4j/util/EnvironmentPropertySource.java   |  55 +++++++++
 .../log4j/util/PropertiesPropertySource.java    |  54 ++++++++
 .../logging/log4j/util/PropertiesUtil.java      | 123 ++++---------------
 .../log4j/util/PropertyFilePropertySource.java  |  52 ++++++++
 .../logging/log4j/util/PropertySource.java      | 115 +++++++++++++++++
 .../util/SystemPropertiesPropertySource.java    |  48 ++++++++
 ...org.apache.logging.log4j.util.PropertySource |  16 +++
 7 files changed, 367 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
new file mode 100644
index 0000000..d413d61
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/EnvironmentPropertySource.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Map;
+
+/**
+ * PropertySource implementation that uses environment variables as a source. All environment variables must begin
+ * with {@code LOG4J_} so as not to conflict with other variables. Normalized environment variables follow a scheme
+ * like this: {@code log4j2.fooBarProperty} would normalize to {@code LOG4J_FOO_BAR_PROPERTY}.
+ *
+ * @since 2.9
+ */
+public class EnvironmentPropertySource implements PropertySource {
+    @Override
+    public int getPriority() {
+        return -100;
+    }
+
+    @Override
+    public void forEach(final BiConsumer<String, String> action) {
+        for (final Map.Entry<String, String> entry : System.getenv().entrySet()) {
+            final String key = entry.getKey();
+            if (key.startsWith("LOG4J_")) {
+                action.accept(key.substring(6), entry.getValue());
+            }
+        }
+    }
+
+    @Override
+    public CharSequence getNormalForm(final Iterable<? extends CharSequence> tokens) {
+        final StringBuilder sb = new StringBuilder("LOG4J");
+        for (final CharSequence token : tokens) {
+            sb.append('_');
+            for (int i = 0; i < token.length(); i++) {
+                sb.append(Character.toUpperCase(token.charAt(i)));
+            }
+        }
+        return sb.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
new file mode 100644
index 0000000..7622509
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesPropertySource.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * PropertySource backed by a {@link Properties} instance. Normalized property names follow a scheme like this:
+ * {@code Log4jContextSelector} would normalize to {@code log4j2.contextSelector}.
+ *
+ * @since 2.9
+ */
+public class PropertiesPropertySource implements PropertySource {
+
+    private static final String PREFIX = "log4j2.";
+
+    private final Properties properties;
+
+    public PropertiesPropertySource(final Properties properties) {
+        this.properties = properties;
+    }
+
+    @Override
+    public int getPriority() {
+        return 0;
+    }
+
+    @Override
+    public void forEach(final BiConsumer<String, String> action) {
+        for (final Map.Entry<Object, Object> entry : properties.entrySet()) {
+            action.accept(((String) entry.getKey()), ((String) entry.getValue()));
+        }
+    }
+
+    @Override
+    public CharSequence getNormalForm(final Iterable<? extends CharSequence> tokens) {
+        return PREFIX + Util.joinAsCamelCase(tokens);
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
index b760076..46f3344 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
@@ -18,16 +18,17 @@ package org.apache.logging.log4j.util;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.nio.charset.Charset;
 import java.nio.charset.UnsupportedCharsetException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * <em>Consider this class private.</em>
@@ -48,7 +49,7 @@ public final class PropertiesUtil {
      * @param props the Properties to use by default
      */
     public PropertiesUtil(final Properties props) {
-        this.environment = new Environment(props);
+        this.environment = new Environment(new PropertiesPropertySource(props));
     }
 
     /**
@@ -58,15 +59,7 @@ public final class PropertiesUtil {
      * @param propertiesFileName the location of properties file to load
      */
     public PropertiesUtil(final String propertiesFileName) {
-        final Properties properties = new Properties();
-        for (final URL url : LoaderUtil.findResources(propertiesFileName)) {
-            try (final InputStream in = url.openStream()) {
-                properties.load(in);
-            } catch (final IOException ioe) {
-                LowLevelLogUtil.logException("Unable to read " + url.toString(), ioe);
-            }
-        }
-        this.environment = new Environment(properties);
+        this.environment = new Environment(new PropertyFilePropertySource(propertiesFileName));
     }
 
     /**
@@ -286,93 +279,31 @@ public final class PropertiesUtil {
      */
     private static class Environment {
 
-        private static final String NORMALIZED_PREFIX = "log4j2.";
-        private static final String PREFIXES = "(?:[Ll]og4j2?|org\\.apache\\.logging\\.log4j\\.)?";
-        private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+)[-._/]?");
-
-        private final Map<String, String> literal = new ConcurrentHashMap<>();
-        private final Map<String, String> normalized = new ConcurrentHashMap<>();
+        private final Map<CharSequence, String> literal = new ConcurrentHashMap<>();
+        private final Map<CharSequence, String> normalized = new ConcurrentHashMap<>();
         private final Map<List<CharSequence>, String> tokenized = new ConcurrentHashMap<>();
 
-        private Environment(final Properties props) {
-            for (final Map.Entry<String, String> entry : System.getenv().entrySet()) {
-                final String envKey = entry.getKey();
-                final String value = entry.getValue();
-                if (envKey.startsWith("LOG4J_")) {
-                    final String key = envKey.substring(6);
-                    literal.put(key, value);
-                    final List<CharSequence> tokens = tokenize(envKey);
-                    if (!tokens.isEmpty()) {
-                        tokenized.put(tokens, value);
-                        normalized.put("LOG4J" + joinAsAllCapsUnderscored(tokens), value);
-                    }
-                }
-            }
-            for (final Map.Entry<Object, Object> entry : props.entrySet()) {
-                final String key = (String) entry.getKey();
-                final String value = (String) entry.getValue();
-                literal.put(key, value);
-                final List<CharSequence> tokens = tokenize(key);
-                if (tokens.isEmpty()) {
-                    normalized.put(NORMALIZED_PREFIX + key, value);
-                } else {
-                    tokenized.put(tokens, value);
-                    normalized.put(NORMALIZED_PREFIX + joinAsCamelCase(tokens), value);
-                }
-
-            }
-            final Properties systemProperties = getSystemProperties();
-            for (Map.Entry<Object, Object> entry : systemProperties.entrySet()) {
-                final String key = (String) entry.getKey();
-                final String value = (String) entry.getValue();
-                literal.put(key, value);
-                // TODO: should this include tokenized lookups? could get screwy
-                final List<CharSequence> tokens = tokenize(key);
-                if (tokens.isEmpty()) {
-                    normalized.put(NORMALIZED_PREFIX + key, value);
-                } else {
-                    tokenized.put(tokens, value);
-                    normalized.put(NORMALIZED_PREFIX + joinAsCamelCase(tokens), value);
-                }
-            }
-        }
-
-        private static CharSequence joinAsAllCapsUnderscored(final List<CharSequence> tokens) {
-            final StringBuilder sb = new StringBuilder();
-            for (final CharSequence token : tokens) {
-                sb.append('_');
-                for (int i = 0; i < token.length(); i++) {
-                    sb.append(Character.toUpperCase(token.charAt(i)));
-                }
+        private Environment(final PropertySource propertySource) {
+            final Set<PropertySource> sources = new TreeSet<>(new PropertySource.Comparator());
+            sources.add(propertySource);
+            for (final PropertySource source : ServiceLoader.load(PropertySource.class)) {
+                sources.add(source);
             }
-            return sb.toString();
-        }
-
-        private static CharSequence joinAsCamelCase(final List<CharSequence> tokens) {
-            final StringBuilder sb = new StringBuilder();
-            boolean first = true;
-            for (final CharSequence token : tokens) {
-                if (first) {
-                    sb.append(token);
-                } else {
-                    sb.append(Character.toUpperCase(token.charAt(0)));
-                    if (token.length() > 1) {
-                        sb.append(token.subSequence(1, token.length()));
+            for (final PropertySource source : sources) {
+                source.forEach(new BiConsumer<String, String>() {
+                    @Override
+                    public void accept(final String key, final String value) {
+                        literal.put(key, value);
+                        final List<CharSequence> tokens = PropertySource.Util.tokenize(key);
+                        if (tokens.isEmpty()) {
+                            normalized.put(source.getNormalForm(Collections.singleton(key)), value);
+                        } else {
+                            normalized.put(source.getNormalForm(tokens), value);
+                            tokenized.put(tokens, value);
+                        }
                     }
-                }
-                first = false;
-            }
-            return sb.toString();
-        }
-
-        private static List<CharSequence> tokenize(final CharSequence value) {
-            // TODO: cache?
-            List<CharSequence> tokens = new ArrayList<>();
-            final Matcher matcher = PROPERTY_TOKENIZER.matcher(value);
-            while (matcher.find()) {
-                tokens.add(matcher.group(1).toLowerCase());
+                });
             }
-            return tokens;
         }
 
         private String get(final String key) {
@@ -391,7 +322,7 @@ public final class PropertiesUtil {
             if (prop != null) {
                 return prop;
             }
-            return tokenized.get(tokenize(key));
+            return tokenized.get(PropertySource.Util.tokenize(key));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
new file mode 100644
index 0000000..2920460
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertyFilePropertySource.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * PropertySource backed by a properties file. Follows the same conventions as {@link PropertiesPropertySource}.
+ *
+ * @since 2.9
+ */
+public class PropertyFilePropertySource extends PropertiesPropertySource {
+
+    public PropertyFilePropertySource(final String fileName) {
+        super(loadPropertiesFile(fileName));
+    }
+
+    private static Properties loadPropertiesFile(final String fileName) {
+        final Properties props = new Properties();
+        for (final URL url : LoaderUtil.findResources(fileName)) {
+            try (final InputStream in = url.openStream()) {
+                props.load(in);
+            } catch (IOException e) {
+                LowLevelLogUtil.logException("Unable to read " + url, e);
+            }
+        }
+        return props;
+    }
+
+    @Override
+    public int getPriority() {
+        return 0;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
new file mode 100644
index 0000000..4dd9cf3
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
@@ -0,0 +1,115 @@
+package org.apache.logging.log4j.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * A source for global configuration properties.
+ *
+ * @since 2.9
+ */
+public interface PropertySource {
+
+    /**
+     * Returns the order in which this PropertySource has priority. A higher value means that the source will be
+     * applied later so as to take precedence over other property sources.
+     *
+     * @return priority value
+     */
+    int getPriority();
+
+    /**
+     * Iterates over all properties and performs an action for each key/value pair.
+     *
+     * @param action action to perform on each key/value pair
+     */
+    void forEach(BiConsumer<String, String> action);
+
+    /**
+     * Converts a list of property name tokens into a normal form. For example, a list of tokens such as
+     * "foo", "bar", "baz", might be normalized into the property name "log4j2.fooBarBaz".
+     *
+     * @param tokens list of property name tokens
+     * @return a normalized property name using the given tokens
+     */
+    CharSequence getNormalForm(Iterable<? extends CharSequence> tokens);
+
+    /**
+     * Comparator for ordering PropertySource instances by priority.
+     *
+     * @since 2.9
+     */
+    class Comparator implements java.util.Comparator<PropertySource>, Serializable {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public int compare(final PropertySource o1, final PropertySource o2) {
+            return Integer.compare(Objects.requireNonNull(o1).getPriority(), Objects.requireNonNull(o2).getPriority());
+        }
+    }
+
+    /**
+     * Utility methods useful for PropertySource implementations.
+     *
+     * @since 2.9
+     */
+    final class Util {
+        private static final String PREFIXES = "(?:[Ll]og4j2?|org\\.apache\\.logging\\.log4j\\.)?";
+        private static final Pattern PROPERTY_TOKENIZER = Pattern.compile(PREFIXES + "([A-Z]*[a-z0-9]+)[-._/]?");
+        private static final Map<CharSequence, List<CharSequence>> CACHE = new ConcurrentHashMap<>();
+
+        /**
+         * Converts a property name string into a list of tokens. This will strip a prefix of {@code log4j},
+         * {@code log4j2}, {@code Log4j}, or {@code org.apache.logging.log4j}, along with separators of
+         * dash {@code -}, dot {@code .}, underscore {@code _}, and slash {@code /}. Tokens can also be separated
+         * by camel case conventions without needing a separator character in between.
+         *
+         * @param value property name
+         * @return the property broken into lower case tokens
+         */
+        public static List<CharSequence> tokenize(final CharSequence value) {
+            if (CACHE.containsKey(value)) {
+                return CACHE.get(value);
+            }
+            List<CharSequence> tokens = new ArrayList<>();
+            final Matcher matcher = PROPERTY_TOKENIZER.matcher(value);
+            while (matcher.find()) {
+                tokens.add(matcher.group(1).toLowerCase());
+            }
+            CACHE.put(value, tokens);
+            return tokens;
+        }
+
+        /**
+         * Joins a list of strings using camelCaseConventions.
+         *
+         * @param tokens tokens to convert
+         * @return tokensAsCamelCase
+         */
+        public static CharSequence joinAsCamelCase(final Iterable<? extends CharSequence> tokens) {
+            final StringBuilder sb = new StringBuilder();
+            boolean first = true;
+            for (final CharSequence token : tokens) {
+                if (first) {
+                    sb.append(token);
+                } else {
+                    sb.append(Character.toUpperCase(token.charAt(0)));
+                    if (token.length() > 1) {
+                        sb.append(token.subSequence(1, token.length()));
+                    }
+                }
+                first = false;
+            }
+            return sb.toString();
+        }
+
+        private Util() {
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
new file mode 100644
index 0000000..8733f23
--- /dev/null
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/SystemPropertiesPropertySource.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.Map;
+
+/**
+ * PropertySource backed by the current system properties. Other than having a higher priority over normal properties,
+ * this follows the same rules as {@link PropertiesPropertySource}.
+ *
+ * @since 2.9
+ */
+public class SystemPropertiesPropertySource implements PropertySource {
+
+    private static final String PREFIX = "log4j2.";
+
+    @Override
+    public int getPriority() {
+        return 100;
+    }
+
+    @Override
+    public void forEach(final BiConsumer<String, String> action) {
+        for (final Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
+            action.accept(((String) entry.getKey()), ((String) entry.getValue()));
+        }
+    }
+
+    @Override
+    public CharSequence getNormalForm(final Iterable<? extends CharSequence> tokens) {
+        return PREFIX + Util.joinAsCamelCase(tokens);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d777b6f5/log4j-api/src/main/resources/META-INF/services/org.apache.logging.log4j.util.PropertySource
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/resources/META-INF/services/org.apache.logging.log4j.util.PropertySource b/log4j-api/src/main/resources/META-INF/services/org.apache.logging.log4j.util.PropertySource
new file mode 100644
index 0000000..39c959c
--- /dev/null
+++ b/log4j-api/src/main/resources/META-INF/services/org.apache.logging.log4j.util.PropertySource
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache license, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the license for the specific language governing permissions and
+# limitations under the license.
+org.apache.logging.log4j.util.EnvironmentPropertySource
+org.apache.logging.log4j.util.SystemPropertiesPropertySource
\ No newline at end of file


[10/15] logging-log4j2 git commit: Add legacy properties unit test

Posted by ma...@apache.org.
Add legacy properties unit test

Related to LOG4J2-1431.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/11dd04ac
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/11dd04ac
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/11dd04ac

Branch: refs/heads/master
Commit: 11dd04acc15d1ba592f9693804d5e265963cda5e
Parents: 51f8e87
Author: Matt Sicker <ma...@spr.com>
Authored: Sat Aug 26 15:50:13 2017 -0500
Committer: Matt Sicker <ma...@spr.com>
Committed: Sat Aug 26 15:50:57 2017 -0500

----------------------------------------------------------------------
 .../util/LegacyPropertiesCompatibilityTest.java | 103 +++++++++++++++++++
 1 file changed, 103 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/11dd04ac/log4j-api/src/test/java/org/apache/logging/log4j/util/LegacyPropertiesCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/LegacyPropertiesCompatibilityTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/LegacyPropertiesCompatibilityTest.java
new file mode 100644
index 0000000..b979d9a
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/LegacyPropertiesCompatibilityTest.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.util;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.junit.Assert.*;
+
+@RunWith(Parameterized.class)
+public class LegacyPropertiesCompatibilityTest {
+
+    private final CharSequence newName;
+    private final CharSequence oldName;
+
+    public LegacyPropertiesCompatibilityTest(final CharSequence newName, final CharSequence oldName) {
+        this.newName = newName;
+        this.oldName = oldName;
+    }
+
+    @Parameterized.Parameters(name = "New: {0}; Old: {1}")
+    public static Object[][] data() {
+        return new Object[][]{
+            {"log4j2.configurationFile", "log4j.configurationFile"},
+            {"log4j2.mergeFactory", "log4j.mergeFactory"},
+            {"log4j2.contextSelector", "Log4jContextSelector"},
+            {"log4j2.logEventFactory", "Log4jLogEventFactory"},
+            {"log4j2.configurationFactory", "log4j.configurationFactory"},
+            {"log4j2.shutdownCallbackRegistry", "log4j.shutdownCallbackRegistry"},
+            {"log4j2.clock", "log4j.Clock"},
+            {"log4j2.level", "org.apache.logging.log4j.level"},
+            {"log4j2.disableThreadContext", "disableThreadContext"},
+            {"log4j2.disableThreadContextStack", "disableThreadContextStack"},
+            {"log4j2.disableThreadContextMap", "disableThreadContextMap"},
+            {"log4j2.isThreadContextMapInheritable", "isThreadContextMapInheritable"},
+            {"log4j2.contextDataInjector", "log4j2.ContextDataInjector"},
+            {"log4j2.garbagefreeThreadContextMap", "log4j2.garbagefree.threadContextMap"},
+            {"log4j2.disableJmx", "log4j2.disable.jmx"},
+            {"log4j2.jmxNotifyAsync", "log4j2.jmx.notify.async"},
+            {"log4j2.skipJansi", "log4j.skipJansi"},
+            {"log4j2.ignoreTCL", "log4j.ignoreTCL"},
+            {"log4j2.ignoreTCL", "LOG4J_IGNORE_TCL"}, // just a sanity check for fun camel case names
+            {"log4j2.uuidSequence", "org.apache.logging.log4j.uuidSequence"},
+            {"log4j2.assignedSequences", "org.apache.logging.log4j.assignedSequences"},
+            {"log4j2.simplelogShowContextMap", "org.apache.logging.log4j.simplelog.showContextMap"},
+            {"log4j2.simplelogShowlogname", "org.apache.logging.log4j.simplelog.showlogname"},
+            {"log4j2.simplelogShowShortLogname", "org.apache.logging.log4j.simplelog.showShortLogname"},
+            {"log4j2.simplelogShowdatetime", "org.apache.logging.log4j.simplelog.showdatetime"},
+            {"log4j2.simplelogDateTimeFormat", "org.apache.logging.log4j.simplelog.dateTimeFormat"},
+            {"log4j2.simplelogLogFile", "org.apache.logging.log4j.simplelog.logFile"},
+            {"log4j2.simplelogLevel", "org.apache.logging.log4j.simplelog.level"},
+            {"log4j2.simplelog.com.foo.bar.Thing.level", "org.apache.logging.log4j.simplelog.com.foo.bar.Thing.level"},
+            {"log4j2.simplelogComFooBarThingLevel", "org.apache.logging.log4j.simplelog.com.foo.bar.Thing.level"},
+            {"log4j2.simplelogStatusLoggerLevel", "org.apache.logging.log4j.simplelog.StatusLogger.level"},
+            {"log4j2.defaultStatusLevel", "Log4jDefaultStatusLevel"},
+            {"log4j2.statusLoggerLevel", "log4j2.StatusLogger.level"},
+            {"log4j2.statusEntries", "log4j2.status.entries"},
+            {"log4j2.asyncLoggerExceptionHandler", "AsyncLogger.ExceptionHandler"},
+            {"log4j2.asyncLoggerRingBufferSize", "AsyncLogger.RingBufferSize"},
+            {"log4j2.asyncLoggerWaitStrategy", "AsyncLogger.WaitStrategy"},
+            {"log4j2.asyncLoggerThreadNameStrategy", "AsyncLogger.ThreadNameStrategy"},
+            {"log4j2.asyncLoggerConfigExceptionHandler", "AsyncLoggerConfig.ExceptionHandler"},
+            {"log4j2.asyncLoggerConfigRingBufferSize", "AsyncLoggerConfig.RingBufferSize"},
+            {"log4j2.asyncLoggerConfigWaitStrategy", "AsyncLoggerConfig.WaitStrategy"},
+            {"log4j2.julLoggerAdapter", "log4j.jul.LoggerAdapter"},
+            {"log4j2.formatMsgAsync", "log4j.format.msg.async"},
+            {"log4j2.asyncQueueFullPolicy", "log4j2.AsyncQueueFullPolicy"},
+            {"log4j2.discardThreshold", "log4j2.DiscardThreshold"},
+            {"log4j2.isWebapp", "log4j2.is.webapp"},
+            {"log4j2.enableThreadlocals", "log4j2.enable.threadlocals"},
+            {"log4j2.enableDirectEncoders", "log4j2.enable.direct.encoders"},
+            {"log4j2.initialReusableMsgSize", "log4j.initialReusableMsgSize"},
+            {"log4j2.maxReusableMsgSize", "log4j.maxReusableMsgSize"},
+            {"log4j2.layoutStringBuilderMaxSize", "log4j.layoutStringBuilder.maxSize"},
+            {"log4j2.unboxRingbufferSize", "log4j.unbox.ringbuffer.size"},
+            {"log4j2.loggerContextStacktraceOnStart", "log4j.LoggerContext.stacktrace.on.start"},
+        };
+    }
+
+    @Test
+    public void compareNewWithOldName() throws Exception {
+        final List<CharSequence> newTokens = PropertySource.Util.tokenize(newName);
+        final List<CharSequence> oldTokens = PropertySource.Util.tokenize(oldName);
+        assertEquals(oldTokens, newTokens);
+    }
+}
\ No newline at end of file