logging-log4j2 git commit: Fix regression.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master a9358ce20 -> d70a3872c


Fix regression.

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

Branch: refs/heads/master
Commit: d70a3872cef04c77e9f062ed6ec5fd9bd76c7e06
Parents: a9358ce
Author: Gary Gregory 
Authored: Fri Sep 23 22:50:36 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 22:50:36 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java | 22 
 1 file changed, 9 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d70a3872/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index a5c0243..ca870c9 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -106,13 +106,11 @@ public class Log4j1ConfigurationParser {
 builder.setStatusLevel(Level.DEBUG);
 }
 // Root
-final String[] sortedAppenderNamesC = 
buildRootLogger(getLog4jValue(ROOTCATEGORY));
-final String[] sortedAppenderNamesL = 
buildRootLogger(getLog4jValue(ROOTLOGGER));
-final String[] sortedAppenderNames = sortedAppenderNamesL.length > 
0 ? sortedAppenderNamesL
-: sortedAppenderNamesC;
+buildRootLogger(getLog4jValue(ROOTCATEGORY));
+buildRootLogger(getLog4jValue(ROOTLOGGER));
 // Appenders
-final Map classNameToProperty = 
buildClassToPropertyPrefixMap(sortedAppenderNames);
-for (final Map.Entry entry : 
classNameToProperty.entrySet()) {
+final Map appenderNameToClassName = 
buildClassToPropertyPrefixMap();
+for (final Map.Entry entry : 
appenderNameToClassName.entrySet()) {
 final String appenderName = entry.getKey();
 final String appenderClass = entry.getValue();
 buildAppender(appenderName, appenderClass);
@@ -140,10 +138,10 @@ public class Log4j1ConfigurationParser {
 System.err.println(string);
 }
 
-private Map buildClassToPropertyPrefixMap(final String[] 
sortedAppenderNames) {
+private Map buildClassToPropertyPrefixMap() {
 final String prefix = "log4j.appender.";
 final int preLength = prefix.length();
-final Map map = new 
HashMap<>(sortedAppenderNames.length);
+final Map map = new HashMap<>();
 for (final Map.Entry entry : properties.entrySet()) {
 final Object keyObj = entry.getKey();
 if (keyObj != null) {
@@ -151,11 +149,9 @@ public class Log4j1ConfigurationParser {
 if (key.startsWith(prefix)) {
 if (key.indexOf('.', preLength) < 0) {
 final String name = key.substring(preLength);
-if (Arrays.binarySearch(sortedAppenderNames, name) == 
-1) {
-final Object value = entry.getValue();
-if (value != null) {
-map.put(name, value.toString());
-}
+final Object value = entry.getValue();
+if (value != null) {
+map.put(name, value.toString());
 }
 }
 }



logging-log4j2 git commit: toString() is implied.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master f1077b805 -> a9358ce20


toString() is implied.

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

Branch: refs/heads/master
Commit: a9358ce204f227cbe2c445a556a263d4728f679b
Parents: f1077b8
Author: Gary Gregory 
Authored: Fri Sep 23 22:38:56 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 22:38:56 2016 -0700

--
 .../java/org/apache/log4j/config/Log4j1ConfigurationFactory.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a9358ce2/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
index 970a43f..83f6675 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationFactory.java
@@ -45,7 +45,7 @@ public class Log4j1ConfigurationFactory extends 
ConfigurationFactory {
 try (final InputStream configStream = source.getInputStream()) {
 builder = new 
Log4j1ConfigurationParser().buildConfigurationBuilder(configStream);
 } catch (final IOException e) {
-throw new ConfigurationException("Unable to load " + 
source.toString(), e);
+throw new ConfigurationException("Unable to load " + source, e);
 }
 return builder.build();
 }



logging-log4j2 git commit: Sort properties.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2b1eef93f -> 979e25dd4


Sort properties.

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

Branch: refs/heads/master
Commit: 979e25dd4adf31abe676b076c1a1e2f51dbfa5eb
Parents: 2b1eef9
Author: Gary Gregory 
Authored: Fri Sep 23 22:06:50 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 22:06:50 2016 -0700

--
 .../java/org/apache/log4j/config/Log4j1ConfigurationParser.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/979e25dd/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index 4ff3924..a5c0243 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Properties;
+import java.util.TreeMap;
 
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
@@ -127,7 +128,7 @@ public class Log4j1ConfigurationParser {
 }
 
 private void buildProperties() {
-for (Map.Entry entry : properties.entrySet()) {
+for (Map.Entry entry : new 
TreeMap<>(properties).entrySet()) {
 final String key = entry.getKey().toString();
 if (!key.startsWith("log4j.") && !key.equals(ROOTCATEGORY) && 
!key.equals(ROOTLOGGER)) {
 builder.addProperty(key, Objects.toString(entry.getValue(), 
Strings.EMPTY));



logging-log4j2 git commit: Remove unused import.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 4c751c683 -> 2b1eef93f


Remove unused import.

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

Branch: refs/heads/master
Commit: 2b1eef93fd2c0fe5049f79ad3fcb8778fbdbcb50
Parents: 4c751c6
Author: Gary Gregory 
Authored: Fri Sep 23 21:44:55 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 21:44:55 2016 -0700

--
 .../java/org/apache/log4j/config/Log4j1ConfigurationParser.java   | 3 ---
 1 file changed, 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2b1eef93/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index be9d4b9..4ff3924 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -24,8 +24,6 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Properties;
 
-import javax.swing.text.StyledEditorKit.ForegroundAction;
-
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.appender.FileAppender;
@@ -43,7 +41,6 @@ import 
org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.Strings;
-import org.apache.velocity.runtime.directive.Foreach;
 
 /**
  * Experimental parser for Log4j 1.2 properties configuration files.



logging-log4j2 git commit: Convert properties.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 762f601a9 -> 4c751c683


Convert properties.

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

Branch: refs/heads/master
Commit: 4c751c6832626db8b8c308a98e7107a50fd13f5a
Parents: 762f601
Author: Gary Gregory 
Authored: Fri Sep 23 19:01:14 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 19:01:14 2016 -0700

--
 .../apache/log4j/config/Log4j1ConfigurationParser.java  | 12 
 1 file changed, 12 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4c751c68/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index bdcc32d..be9d4b9 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -21,6 +21,7 @@ import java.io.InputStream;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Properties;
 
 import javax.swing.text.StyledEditorKit.ForegroundAction;
@@ -41,6 +42,7 @@ import 
org.apache.logging.log4j.core.config.builder.api.RootLoggerComponentBuild
 import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
 import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.Strings;
 import org.apache.velocity.runtime.directive.Foreach;
 
 /**
@@ -120,12 +122,22 @@ public class Log4j1ConfigurationParser {
 // Loggers
 buildLoggers("log4j.category.");
 buildLoggers("log4j.logger.");
+buildProperties();
 return builder;
 } catch (final IllegalArgumentException e) {
 throw new ConfigurationException(e);
 }
 }
 
+private void buildProperties() {
+for (Map.Entry entry : properties.entrySet()) {
+final String key = entry.getKey().toString();
+if (!key.startsWith("log4j.") && !key.equals(ROOTCATEGORY) && 
!key.equals(ROOTLOGGER)) {
+builder.addProperty(key, Objects.toString(entry.getValue(), 
Strings.EMPTY));
+}
+}
+}
+
 private void warn(String string) {
 System.err.println(string);
 }



logging-log4j2 git commit: Do not convert strings to Level objects internally since they can be variables.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 180b38c96 -> 762f601a9


Do not convert strings to Level objects internally since they can be
variables.

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

Branch: refs/heads/master
Commit: 762f601a966aef70f86dde22b7473e0b769afd9f
Parents: 180b38c
Author: Gary Gregory 
Authored: Fri Sep 23 18:37:51 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 18:37:51 2016 -0700

--
 .../org/apache/log4j/config/Log4j1ConfigurationParser.java   | 8 
 .../log4j/config/Log4j1ConfigurationConverterHadoopTest.java | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/762f601a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index ca13bab..bdcc32d 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -360,7 +360,7 @@ public class Log4j1ConfigurationParser {
 return new String[0];
 }
 final String[] rootLoggerParts = 
rootLoggerValue.split(COMMA_DELIMITED_RE);
-final Level rootLoggerLevel = getLevel(rootLoggerParts, Level.ERROR);
+final String rootLoggerLevel = getLevelString(rootLoggerParts, 
Level.ERROR.name());
 final String[] sortedAppenderNames = 
Arrays.copyOfRange(rootLoggerParts, 1, rootLoggerParts.length);
 Arrays.sort(sortedAppenderNames);
 final RootLoggerComponentBuilder loggerBuilder = 
builder.newRootLogger(rootLoggerLevel);
@@ -371,8 +371,8 @@ public class Log4j1ConfigurationParser {
 return sortedAppenderNames;
 }
 
-private Level getLevel(final String[] loggerParts, final Level 
defaultLevel) {
-return loggerParts.length > 0 ? Level.valueOf(loggerParts[0]) : 
defaultLevel;
+private String getLevelString(final String[] loggerParts, final String 
defaultLevel) {
+return loggerParts.length > 0 ? loggerParts[0] : defaultLevel;
 }
 
 private void buildLoggers(final String prefix) {
@@ -388,7 +388,7 @@ public class Log4j1ConfigurationParser {
 // a Level may be followed by a list of Appender refs.
 final String valueStr = value.toString();
 final String[] split = 
valueStr.split(COMMA_DELIMITED_RE);
-final Level level = getLevel(split, null);
+final String level = getLevelString(split, null);
 if (level == null) {
 warn("Level is missing for entry " + entry);
 } else {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/762f601a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationConverterHadoopTest.java
--
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationConverterHadoopTest.java
 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationConverterHadoopTest.java
index fd40ed7..06cbc9d 100644
--- 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationConverterHadoopTest.java
+++ 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationConverterHadoopTest.java
@@ -25,7 +25,6 @@ import org.junit.runners.Parameterized;
  * limitations under the license.
  */
 
-@Ignore("Some files cannot be converted!")
 @RunWith(Parameterized.class)
 public class Log4j1ConfigurationConverterHadoopTest extends 
AbstractLog4j1ConfigurationConverterTest {
 



logging-log4j2 git commit: Refactor some common code.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 88e4497ea -> 180b38c96


Refactor some common code.

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

Branch: refs/heads/master
Commit: 180b38c9695273acd61f9a5d42b8ab5be9924361
Parents: 88e4497
Author: Gary Gregory 
Authored: Fri Sep 23 18:32:11 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 18:32:11 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java  | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/180b38c9/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index 5462697..ca13bab 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -61,6 +61,7 @@ import org.apache.velocity.runtime.directive.Foreach;
  */
 public class Log4j1ConfigurationParser {
 
+private static final String COMMA_DELIMITED_RE = "\\s*,\\s*";
 private static final String ROOTLOGGER = "rootLogger";
 private static final String ROOTCATEGORY = "rootCategory";
 private static final String TRUE = "true";
@@ -358,8 +359,8 @@ public class Log4j1ConfigurationParser {
 if (rootLoggerValue == null) {
 return new String[0];
 }
-final String[] rootLoggerParts = rootLoggerValue.split("\\s*,\\s*");
-final Level rootLoggerLevel = rootLoggerParts.length > 0 ? 
Level.valueOf(rootLoggerParts[0]) : Level.ERROR;
+final String[] rootLoggerParts = 
rootLoggerValue.split(COMMA_DELIMITED_RE);
+final Level rootLoggerLevel = getLevel(rootLoggerParts, Level.ERROR);
 final String[] sortedAppenderNames = 
Arrays.copyOfRange(rootLoggerParts, 1, rootLoggerParts.length);
 Arrays.sort(sortedAppenderNames);
 final RootLoggerComponentBuilder loggerBuilder = 
builder.newRootLogger(rootLoggerLevel);
@@ -370,6 +371,10 @@ public class Log4j1ConfigurationParser {
 return sortedAppenderNames;
 }
 
+private Level getLevel(final String[] loggerParts, final Level 
defaultLevel) {
+return loggerParts.length > 0 ? Level.valueOf(loggerParts[0]) : 
defaultLevel;
+}
+
 private void buildLoggers(final String prefix) {
 final int preLength = prefix.length();
 for (final Map.Entry entry : properties.entrySet()) {
@@ -382,12 +387,12 @@ public class Log4j1ConfigurationParser {
 if (value != null) {
 // a Level may be followed by a list of Appender refs.
 final String valueStr = value.toString();
-final String[] split = valueStr.split("\\s*,\\s*");
-final String levelStr = split.length > 0 ? split[0] : 
null;
-if (levelStr == null) {
-warn("Level is missing: " + entry);
+final String[] split = 
valueStr.split(COMMA_DELIMITED_RE);
+final Level level = getLevel(split, null);
+if (level == null) {
+warn("Level is missing for entry " + entry);
 } else {
-final LoggerComponentBuilder newLogger = 
builder.newLogger(name, Level.valueOf(levelStr));
+final LoggerComponentBuilder newLogger = 
builder.newLogger(name, level);
 if (split.length > 1) {
 // Add Appenders to this logger
 for (int i = 1; i < split.length; i++) {



logging-log4j2 git commit: Allow for a logger to be defined as "Level, AppenderRef, AppenderRef, ..."

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2fc6784f7 -> a6cf48e93


Allow for a logger to be defined as "Level, AppenderRef, AppenderRef,
..."

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

Branch: refs/heads/master
Commit: a6cf48e934a6de94df5c302db6b55d29027c3cc8
Parents: 2fc6784
Author: Gary Gregory 
Authored: Fri Sep 23 18:10:28 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 18:10:28 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java | 21 +++-
 1 file changed, 20 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a6cf48e9/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index da9bc8f..b346fac 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -23,6 +23,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import javax.swing.text.StyledEditorKit.ForegroundAction;
+
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.appender.FileAppender;
@@ -34,10 +36,12 @@ import 
org.apache.logging.log4j.core.config.builder.api.ComponentBuilder;
 import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
 import 
org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory;
 import org.apache.logging.log4j.core.config.builder.api.LayoutComponentBuilder;
+import org.apache.logging.log4j.core.config.builder.api.LoggerComponentBuilder;
 import 
org.apache.logging.log4j.core.config.builder.api.RootLoggerComponentBuilder;
 import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
 import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.velocity.runtime.directive.Foreach;
 
 /**
  * Experimental parser for Log4j 1.2 properties configuration files.
@@ -376,7 +380,22 @@ public class Log4j1ConfigurationParser {
 final String name = key.substring(preLength);
 final Object value = entry.getValue();
 if (value != null) {
-builder.add(builder.newLogger(name, 
Level.valueOf(value.toString(;
+// a Level may be followed by a list of Appender refs.
+final String valueStr = value.toString();
+final String[] split = valueStr.split("\\s*,\\s*");
+final String levelStr = split.length > 0 ? split[0] : 
null;
+if (levelStr == null) {
+warn("Level is missing: " + entry);
+} else {
+final LoggerComponentBuilder newLogger = 
builder.newLogger(name, Level.valueOf(levelStr));
+if (split.length > 1) {
+// Add Appenders to this logger
+for (int i = 1; i < split.length; i++) {
+
newLogger.add(builder.newAppenderRef(split[i]));
+}
+}
+builder.add(newLogger);
+}
 }
 }
 }



logging-log4j2 git commit: Minor refactoring of dup calls.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 4791f6d34 -> 2fc6784f7


Minor refactoring of dup calls.

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

Branch: refs/heads/master
Commit: 2fc6784f7566586ff40f8d08ab420e3f94133f85
Parents: 4791f6d
Author: Gary Gregory 
Authored: Fri Sep 23 17:52:59 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 17:52:59 2016 -0700

--
 .../org/apache/log4j/config/Log4j1ConfigurationConverter.java  | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2fc6784f/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
index e48e54c..9e63a73 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
@@ -142,11 +142,13 @@ public final class Log4j1ConfigurationConverter {
 }
 
 InputStream getInputStream() throws IOException {
-return cla.pathIn == null ? System.in : new 
InputStreamWrapper(Files.newInputStream(cla.pathIn), cla.pathIn.toString());
+final Path pathIn = cla.getPathIn();
+return pathIn == null ? System.in : new 
InputStreamWrapper(Files.newInputStream(pathIn), pathIn.toString());
 }
 
 OutputStream getOutputStream() throws IOException {
-return cla.pathOut == null ? System.out : 
Files.newOutputStream(cla.pathOut);
+final Path pathOut = cla.getPathOut();
+return pathOut == null ? System.out : Files.newOutputStream(pathOut);
 }
 
 private void run() {



logging-log4j2 git commit: Better error reporting.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 61e7a5427 -> 4791f6d34


Better error reporting.

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

Branch: refs/heads/master
Commit: 4791f6d34aca5e011da758d4c90a0b86ee613375
Parents: 61e7a54
Author: Gary Gregory 
Authored: Fri Sep 23 17:51:26 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 17:51:26 2016 -0700

--
 .../src/main/java/org/apache/log4j/config/InputStreamWrapper.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4791f6d3/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
index 29ea51a..19bf9a9 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
@@ -50,7 +50,7 @@ class InputStreamWrapper extends InputStream {
 }
 
 @Override
-public void mark(final int readlimit) {
+public synchronized void mark(final int readlimit) {
 input.mark(readlimit);
 }
 



logging-log4j2 git commit: Better error reporting.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 91b599e7b -> 61e7a5427


Better error reporting.

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

Branch: refs/heads/master
Commit: 61e7a542793b0be05264805d75266bd050fd4519
Parents: 91b599e
Author: Gary Gregory 
Authored: Fri Sep 23 17:50:57 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 17:50:57 2016 -0700

--
 .../apache/log4j/config/InputStreamWrapper.java |  92 +++
 .../config/Log4j1ConfigurationConverter.java|   4 +-
 .../log4j/config/Log4j1ConfigurationParser.java | 615 ++-
 3 files changed, 403 insertions(+), 308 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/61e7a542/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
new file mode 100644
index 000..29ea51a
--- /dev/null
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/InputStreamWrapper.java
@@ -0,0 +1,92 @@
+/*
+ * 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.log4j.config;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+class InputStreamWrapper extends InputStream {
+
+private final String description;
+private final InputStream input;
+
+public InputStreamWrapper(final InputStream input, final String 
description) {
+this.input = input;
+this.description = description;
+}
+
+@Override
+public int available() throws IOException {
+return input.available();
+}
+
+@Override
+public void close() throws IOException {
+input.close();
+}
+
+@Override
+public boolean equals(final Object obj) {
+return input.equals(obj);
+}
+
+@Override
+public int hashCode() {
+return input.hashCode();
+}
+
+@Override
+public void mark(final int readlimit) {
+input.mark(readlimit);
+}
+
+@Override
+public boolean markSupported() {
+return input.markSupported();
+}
+
+@Override
+public int read() throws IOException {
+return input.read();
+}
+
+@Override
+public int read(final byte[] b) throws IOException {
+return input.read(b);
+}
+
+@Override
+public int read(final byte[] b, final int off, final int len) throws 
IOException {
+return input.read(b, off, len);
+}
+
+@Override
+public synchronized void reset() throws IOException {
+input.reset();
+}
+
+@Override
+public long skip(final long n) throws IOException {
+return input.skip(n);
+}
+
+@Override
+public String toString() {
+return getClass().getSimpleName() + " [description=" + description + 
", input=" + input + "]";
+}
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/61e7a542/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
index c9c8bc5..e48e54c 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
@@ -142,7 +142,7 @@ public final class Log4j1ConfigurationConverter {
 }
 
 InputStream getInputStream() throws IOException {
-return cla.pathIn == null ? System.in : 

logging-log4j2 git commit: Make it easier to copy a file name to open in an editor.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master b6ff099cf -> 91b599e7b


Make it easier to copy a file name to open in an editor.

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

Branch: refs/heads/master
Commit: 91b599e7bf7c7fbe18f076e63577e1cff251d7fb
Parents: b6ff099
Author: Gary Gregory 
Authored: Fri Sep 23 17:28:17 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 17:28:17 2016 -0700

--
 .../log4j/config/AbstractLog4j1ConfigurationConverterTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/91b599e7/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
--
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
index 4afcf78..f9209e2 100644
--- 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
+++ 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
@@ -39,7 +39,7 @@ public abstract class 
AbstractLog4j1ConfigurationConverterTest {
 Files.walkFileTree(Paths.get(root), new SimpleFileVisitor() {
 @Override
 public FileVisitResult visitFile(final Path file, final 
BasicFileAttributes attrs) throws IOException {
-paths.add(file);
+paths.add(file.toAbsolutePath());
 return FileVisitResult.CONTINUE;
 }
 });



logging-log4j2 git commit: Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to see what we cannot convert yet (at least what the converter blows up on).

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2f7a0c8d4 -> b6ff099cf


Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to
see what we cannot convert yet (at least what the converter blows up
on).

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

Branch: refs/heads/master
Commit: b6ff099cf45dcf4baba0e77d6c6f5ef2eeb458a2
Parents: 2f7a0c8
Author: Gary Gregory 
Authored: Fri Sep 23 17:19:05 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 17:19:05 2016 -0700

--
 ...bstractLog4j1ConfigurationConverterTest.java | 62 
 .../Log4j1ConfigurationConverterHadoopTest.java | 31 +-
 .../Log4j1ConfigurationConverterSparkTest.java  | 39 
 .../test/resources/config-1.2/hadoop/readme.txt |  1 -
 .../config-1.2/spark/R/log4j.properties | 28 +
 .../src/test/resources/log4j.properties | 27 +
 .../src/test/resources/log4j.properties | 24 
 .../core/src/test/resources/log4j.properties| 36 
 .../src/test/resources/log4j.properties | 28 +
 .../flume/src/test/resources/log4j.properties   | 28 +
 .../src/test/resources/log4j.properties | 27 +
 .../src/test/resources/log4j.properties | 28 +
 .../src/test/resources/log4j.properties | 28 +
 .../src/main/resources/log4j.properties | 37 
 .../src/test/resources/log4j.properties | 27 +
 .../graphx/src/test/resources/log4j.properties  | 27 +
 .../src/test/resources/log4j.properties | 33 +++
 .../mllib/src/test/resources/log4j.properties   | 28 +
 .../repl/src/test/resources/log4j.properties| 27 +
 .../src/test/resources/log4j.properties | 27 +
 .../core/src/test/resources/log4j.properties| 57 ++
 .../hive/src/test/resources/log4j.properties| 61 +++
 .../src/test/resources/log4j.properties | 28 +
 .../yarn/src/test/resources/log4j.properties| 31 ++
 24 files changed, 741 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b6ff099c/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
--
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
new file mode 100644
index 000..4afcf78
--- /dev/null
+++ 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/AbstractLog4j1ConfigurationConverterTest.java
@@ -0,0 +1,62 @@
+package org.apache.log4j.config;
+
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/*
+ * 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.
+ */
+
+@RunWith(Parameterized.class)
+public abstract class AbstractLog4j1ConfigurationConverterTest {
+
+protected static List getPaths(final String root) throws IOException 
{
+final List paths = new ArrayList<>();
+Files.walkFileTree(Paths.get(root), new SimpleFileVisitor() {
+@Override
+public FileVisitResult visitFile(final Path file, final 
BasicFileAttributes attrs) throws IOException {
+paths.add(file);
+return FileVisitResult.CONTINUE;
+}
+

logging-log4j2 git commit: Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to see what we cannot convert yet (at least what the converter blows up on).

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 799ca97db -> 2f7a0c8d4


Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to
see what we cannot convert yet (at least what the converter blows up
on).

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

Branch: refs/heads/master
Commit: 2f7a0c8d4fceb162bd397ab5be7a6fd3a301cab8
Parents: 799ca97
Author: Gary Gregory 
Authored: Fri Sep 23 17:11:21 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 17:11:21 2016 -0700

--
 log4j-1.2-api/src/test/resources/config-1.2/hadoop/readme.txt | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2f7a0c8d/log4j-1.2-api/src/test/resources/config-1.2/hadoop/readme.txt
--
diff --git a/log4j-1.2-api/src/test/resources/config-1.2/hadoop/readme.txt 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/readme.txt
new file mode 100644
index 000..f14540c
--- /dev/null
+++ b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/readme.txt
@@ -0,0 +1 @@
+These files were all copied from Hadoop sources in Git.
\ No newline at end of file



[1/2] logging-log4j2 git commit: Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to see what we cannot convert yet (at least what the converter blows up on).

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master e58fab172 -> 799ca97db


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/799ca97d/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/resources/log4j.properties
--
diff --git 
a/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/resources/log4j.properties
 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/resources/log4j.properties
new file mode 100644
index 000..c088bb7
--- /dev/null
+++ 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/resources/log4j.properties
@@ -0,0 +1,19 @@
+#   Licensed 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.
+
+# log4j configuration used during build and unit tests
+
+log4j.rootLogger=INFO,stdout
+log4j.threshold=ALL
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2} 
(%F:%M(%L)) - %m%n

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/799ca97d/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/resources/log4j.properties
--
diff --git 
a/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/resources/log4j.properties
 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/resources/log4j.properties
new file mode 100644
index 000..81a3f6a
--- /dev/null
+++ 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase-tests/src/test/resources/log4j.properties
@@ -0,0 +1,19 @@
+#   Licensed 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.
+
+# log4j configuration used during build and unit tests
+
+log4j.rootLogger=info,stdout
+log4j.threshold=ALL
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2} 
(%F:%M(%L)) - %m%n

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/799ca97d/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/resources/log4j.properties
--
diff --git 
a/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/resources/log4j.properties
 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/resources/log4j.properties
new file mode 100644
index 000..81a3f6a
--- /dev/null
+++ 
b/log4j-1.2-api/src/test/resources/config-1.2/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/resources/log4j.properties
@@ -0,0 +1,19 @@
+#   Licensed 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, 

[2/2] logging-log4j2 git commit: Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to see what we cannot convert yet (at least what the converter blows up on).

2016-09-23 Thread ggregory
Beef up Log4j 1.2 to 2 convertion utility. The new test makes it easy to
see what we cannot convert yet (at least what the converter blows up
on).

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

Branch: refs/heads/master
Commit: 799ca97dbaeef98adb8ec6bcc2be64f19483d3c0
Parents: e58fab1
Author: Gary Gregory 
Authored: Fri Sep 23 16:43:24 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 16:43:24 2016 -0700

--
 log4j-1.2-api/pom.xml   |   6 +
 .../config/Log4j1ConfigurationConverter.java| 182 ++-
 .../log4j/config/Log4j1ConfigurationParser.java |  71 ++--
 .../Log4j1ConfigurationConverterHadoopTest.java |  66 
 .../src/main/resources/log4j.properties |  19 ++
 .../src/main/conf/log4j.properties  | 323 +++
 .../src/test/resources/log4j.properties |  18 ++
 .../src/test/resources/log4j.properties |  31 ++
 .../src/main/resources/log4j.properties |  31 ++
 .../src/test/resources/log4j.properties |  18 ++
 .../src/test/resources/log4j.properties |  49 +++
 .../src/test/resources/log4j.properties |  55 
 .../src/test/resources/log4j.properties |  49 +++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  23 ++
 .../src/test/resources/log4j.properties |  25 ++
 .../src/test/resources/log4j.properties |  42 +++
 .../src/main/sample-conf/log4j.properties   |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  37 +++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  63 
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../src/test/resources/log4j.properties |  19 ++
 .../plugins/visitors/PluginElementVisitor.java  |   3 +
 35 files changed, 1375 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/799ca97d/log4j-1.2-api/pom.xml
--
diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml
index 779f050..2a5eb01 100644
--- a/log4j-1.2-api/pom.xml
+++ b/log4j-1.2-api/pom.xml
@@ -33,6 +33,12 @@
 /log4j12-api
   
   
+
+
+  com.beust
+  jcommander
+  true
+
 
   junit
   junit

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/799ca97d/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
index 8170708..c9c8bc5 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java
@@ -16,25 +16,193 @@
  */
 package org.apache.log4j.config;
 
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.concurrent.atomic.AtomicInteger;
 
+import org.apache.logging.log4j.core.config.ConfigurationException;
 import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder;
 import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
+import org.apache.logging.log4j.core.util.BasicCommandLineArguments;
+
+import com.beust.jcommander.Parameter;
 
 /**
  * Tool for converting a Log4j 1.x properties configuration file to Log4j 2.x 
XML configuration file.
+ * 
+ * 
+ * Run with "--help" on 

logging-log4j2 git commit: Better assert message.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master fc2a2edd7 -> e58fab172


Better assert message.

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

Branch: refs/heads/master
Commit: e58fab172feb3ad828f0b3fa7c399794088a2f7a
Parents: fc2a2ed
Author: Gary Gregory 
Authored: Fri Sep 23 15:55:30 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 15:55:30 2016 -0700

--
 .../config/Log4j1ConfigurationFactoryTest.java  | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e58fab17/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
--
diff --git 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
index cb58dbe..3e650ee 100644
--- 
a/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
+++ 
b/log4j-1.2-api/src/test/java/org/apache/log4j/config/Log4j1ConfigurationFactoryTest.java
@@ -47,19 +47,21 @@ import org.junit.Test;
 
 public class Log4j1ConfigurationFactoryTest {
 
-   private Layout testConsole(final String configResource) throws 
Exception {
-   final Configuration configuration = configure(configResource);
-   final ConsoleAppender appender = 
configuration.getAppender("Console");
-   assertNotNull(appender);
-   assertEquals(Target.SYSTEM_ERR, appender.getTarget());
-   //
-   final LoggerConfig loggerConfig = 
configuration.getLoggerConfig("com.example.foo");
-   assertNotNull(loggerConfig);
-   assertEquals(Level.DEBUG, loggerConfig.getLevel());
-   configuration.start();
-   configuration.stop();
-   return appender.getLayout();
-   }
+private Layout testConsole(final String configResource) throws 
Exception {
+final Configuration configuration = configure(configResource);
+final String name = "Console";
+final ConsoleAppender appender = configuration.getAppender(name);
+assertNotNull("Missing appender '" + name + "' in configuration " + 
configResource + " → " + configuration,
+appender);
+assertEquals(Target.SYSTEM_ERR, appender.getTarget());
+//
+final LoggerConfig loggerConfig = 
configuration.getLoggerConfig("com.example.foo");
+assertNotNull(loggerConfig);
+assertEquals(Level.DEBUG, loggerConfig.getLevel());
+configuration.start();
+configuration.stop();
+return appender.getLayout();
+}
 
private Layout testFile(final String configResource) throws 
Exception {
final Configuration configuration = configure(configResource);



logging-log4j2 git commit: Javadoc: Use the active voice.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 7a409d4a6 -> fc2a2edd7


Javadoc: Use the active voice.

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

Branch: refs/heads/master
Commit: fc2a2edd7b8f97c97218e8c8e4eb9e8446aa485e
Parents: 7a409d4
Author: Gary Gregory 
Authored: Fri Sep 23 15:51:47 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 15:51:47 2016 -0700

--
 .../logging/log4j/core/config/ConfigurationException.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fc2a2edd/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
index 06f777e..830cdcf 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
@@ -25,7 +25,7 @@ public class ConfigurationException extends RuntimeException {
 private static final long serialVersionUID = -2413951820300775294L;
 
 /**
- * Construct an exception with a message.
+ * Constructs an exception with a message.
  *
  * @param message The reason for the exception
  */
@@ -34,7 +34,7 @@ public class ConfigurationException extends RuntimeException {
 }
 
 /**
- * Construct an exception with a message and underlying cause.
+ * Constructs an exception with a message and underlying cause.
  *
  * @param message The reason for the exception
  * @param cause The underlying cause of the exception
@@ -44,7 +44,7 @@ public class ConfigurationException extends RuntimeException {
 }
 
 /**
- * Construct an exception with a message and underlying cause.
+ * Constructs an exception with a message and underlying cause.
  *
  * @param cause The underlying cause of the exception
  */



logging-log4j2 git commit: Add Throwable ctor for use in upcoming commit.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master e4665a246 -> 7a409d4a6


Add Throwable ctor for use in upcoming commit.

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

Branch: refs/heads/master
Commit: 7a409d4a6277e65b17ba46e3abac68e7ac233387
Parents: e4665a2
Author: Gary Gregory 
Authored: Fri Sep 23 15:51:10 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 15:51:10 2016 -0700

--
 .../logging/log4j/core/config/ConfigurationException.java | 10 ++
 1 file changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7a409d4a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
index 64d8293..06f777e 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
@@ -42,4 +42,14 @@ public class ConfigurationException extends RuntimeException 
{
 public ConfigurationException(final String message, final Throwable cause) 
{
 super(message, cause);
 }
+
+/**
+ * Construct an exception with a message and underlying cause.
+ *
+ * @param cause The underlying cause of the exception
+ */
+public ConfigurationException(final Throwable cause) {
+super(cause);
+}
+
 }



logging-log4j2 git commit: Refactor into a basic command line class to hold common options, right now only "help" but "version" makes sense too and I'll add that later.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 96cc528db -> e4665a246


Refactor into a basic command line class to hold common options, right
now only "help" but "version" makes sense too and I'll add that later.

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

Branch: refs/heads/master
Commit: e4665a2467e714ccd117a6877e583cd71d1788d0
Parents: 96cc528
Author: Gary Gregory 
Authored: Fri Sep 23 15:49:21 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 15:49:21 2016 -0700

--
 .../core/net/server/AbstractSocketServer.java   | 14 +-
 .../core/util/BasicCommandLineArguments.java| 47 
 2 files changed, 49 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e4665a24/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java
index 8e24c25..ab0c945 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java
@@ -35,6 +35,7 @@ import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.ConfigurationSource;
 import org.apache.logging.log4j.core.config.xml.XmlConfiguration;
 import org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory;
+import org.apache.logging.log4j.core.util.BasicCommandLineArguments;
 import org.apache.logging.log4j.core.util.InetAddressConverter;
 import org.apache.logging.log4j.core.util.Log4jThread;
 import org.apache.logging.log4j.util.Strings;
@@ -53,14 +54,11 @@ import com.beust.jcommander.validators.PositiveInteger;
  */
 public abstract class AbstractSocketServer extends 
LogEventListener implements Runnable {
 
-protected static class CommandLineArguments {
+protected static class CommandLineArguments extends 
BasicCommandLineArguments {
 
 @Parameter(names = { "--config", "-c" }, description = "Log4j 
configuration file location (path or URL).")
 private String configLocation;
 
-@Parameter(names = { "--help", "-?", "-h" }, help = true, description 
= "Prints this help.")
-private boolean help;
-
 @Parameter(names = { "--interactive",
 "-i" }, description = "Accepts commands on standard input 
(\"exit\" is the only command).")
 private boolean interactive;
@@ -81,10 +79,6 @@ public abstract class AbstractSocketServer extends LogEve
 return port;
 }
 
-boolean isHelp() {
-return help;
-}
-
 protected boolean isInteractive() {
 return interactive;
 }
@@ -93,10 +87,6 @@ public abstract class AbstractSocketServer extends LogEve
 this.configLocation = configLocation;
 }
 
-void setHelp(final boolean help) {
-this.help = help;
-}
-
 void setInteractive(final boolean interactive) {
 this.interactive = interactive;
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e4665a24/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java
new file mode 100644
index 000..71271d8
--- /dev/null
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java
@@ -0,0 +1,47 @@
+/*
+ * 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 

[2/2] logging-log4j2 git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/logging-log4j2.git

2016-09-23 Thread ggregory
Merge branch 'master' of 
https://git-wip-us.apache.org/repos/asf/logging-log4j2.git

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

Branch: refs/heads/master
Commit: 96cc528db29bb5ede659c4012f88ba411cc5e857
Parents: e46dec2 99b5bd0
Author: Gary Gregory 
Authored: Fri Sep 23 15:16:46 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 15:16:46 2016 -0700

--
 .../org/apache/logging/log4j/core/LogEvent.java |   9 ++
 .../log4j/core/impl/ContextDataFactory.java |  54 -
 .../core/impl/ContextDataInjectorFactory.java   |   6 +-
 .../log4j/core/impl/JdkMapAdapterStringMap.java | 111 +++
 .../core/impl/ThreadContextDataInjector.java|  66 +++
 ...actoryPropertySetMissingConstructorTest.java |  41 +++
 .../impl/ContextDataFactoryPropertySetTest.java |  49 
 .../log4j/core/impl/ContextDataFactoryTest.java |  47 
 .../log4j/core/impl/FactoryTestStringMap.java   | 104 +
 ...ctoryTestStringMapWithoutIntConstructor.java | 100 +
 src/changes/changes.xml |   3 +
 11 files changed, 558 insertions(+), 32 deletions(-)
--




[1/2] logging-log4j2 git commit: Better exception message.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 99b5bd05c -> 96cc528db


Better exception message.

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

Branch: refs/heads/master
Commit: e46dec20534f00bb73b5ace77f0267fc5fe61b15
Parents: b0ac23b
Author: Gary Gregory 
Authored: Fri Sep 23 15:16:30 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 15:16:30 2016 -0700

--
 .../java/org/apache/log4j/config/Log4j1ConfigurationParser.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e46dec20/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index d71349e..6f65b41 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -93,7 +93,7 @@ public class Log4j1ConfigurationParser {
final String rootLoggerValue = getLog4jValue(ROOTLOGGER);
if (rootCategoryValue == null && rootLoggerValue == null) {
// This is not a Log4j 1 properties configuration file.
-   throw new ConfigurationException("Input does not 
contain a valid Log4j 1.x properties configuration");
+   throw new ConfigurationException("Input does not 
contain a valid Log4j 1.x properties configuration: " + input);
}
builder.setConfigurationName("Log4j1");
// DEBUG



logging-log4j2 git commit: Use LoaderUtil instead of Class.forName()

2016-09-23 Thread mattsicker
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 0314bee0f -> 99b5bd05c


Use LoaderUtil instead of Class.forName()


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

Branch: refs/heads/master
Commit: 99b5bd05c7ed164346592717b8f345981f5a6bff
Parents: 0314bee
Author: Matt Sicker 
Authored: Fri Sep 23 13:14:06 2016 -0500
Committer: Matt Sicker 
Committed: Fri Sep 23 13:14:06 2016 -0500

--
 .../org/apache/logging/log4j/core/impl/ContextDataFactory.java| 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/99b5bd05/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
index 9b48dfd..b417072 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
@@ -20,6 +20,7 @@ import java.lang.reflect.Constructor;
 
 import org.apache.logging.log4j.core.ContextDataInjector;
 import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.util.LoaderUtil;
 import org.apache.logging.log4j.util.PropertiesUtil;
 import org.apache.logging.log4j.util.SortedArrayStringMap;
 import org.apache.logging.log4j.util.StringMap;
@@ -51,7 +52,7 @@ public class ContextDataFactory {
 return null;
 }
 try {
-return Class.forName(className);
+return LoaderUtil.loadClass(className);
 } catch (final Exception any) {
 return null;
 }



logging-log4j2 git commit: LOG4J2-1611 LOG4J2-1010 LOG4J2-1447 clean up compiler warnings in test classes

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master cceb1808d -> 0314bee0f


LOG4J2-1611 LOG4J2-1010 LOG4J2-1447 clean up compiler warnings in test classes


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

Branch: refs/heads/master
Commit: 0314bee0f5bad751f63b436bd6727900f7bfdc69
Parents: cceb180
Author: rpopma 
Authored: Sat Sep 24 01:58:22 2016 +0900
Committer: rpopma 
Committed: Sat Sep 24 01:58:22 2016 +0900

--
 .../log4j/core/impl/ContextDataFactoryPropertySetTest.java| 3 ---
 .../org/apache/logging/log4j/core/impl/FactoryTestStringMap.java  | 1 +
 .../core/impl/FactoryTestStringMapWithoutIntConstructor.java  | 1 +
 3 files changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0314bee0/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ContextDataFactoryPropertySetTest.java
--
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ContextDataFactoryPropertySetTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ContextDataFactoryPropertySetTest.java
index b5bb3b2..82d6126 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ContextDataFactoryPropertySetTest.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/ContextDataFactoryPropertySetTest.java
@@ -16,9 +16,6 @@
  */
 package org.apache.logging.log4j.core.impl;
 
-import java.lang.reflect.Field;
-
-import org.apache.logging.log4j.util.SortedArrayStringMap;
 import org.junit.Test;
 
 import static org.junit.Assert.*;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0314bee0/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMap.java
--
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMap.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMap.java
index 9f7fcc7..f3653db 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMap.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMap.java
@@ -27,6 +27,7 @@ import org.apache.logging.log4j.util.TriConsumer;
  * Dummy implementation of the StringMap interface for testing.
  */
 public class FactoryTestStringMap implements StringMap {
+private static final long serialVersionUID = -2035823164390218862L;
 int initialCapacity;
 
 public FactoryTestStringMap() {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0314bee0/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMapWithoutIntConstructor.java
--
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMapWithoutIntConstructor.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMapWithoutIntConstructor.java
index c87e729..ff0f206 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMapWithoutIntConstructor.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/impl/FactoryTestStringMapWithoutIntConstructor.java
@@ -27,6 +27,7 @@ import org.apache.logging.log4j.util.TriConsumer;
  * Dummy implementation of the StringMap interface for testing.
  */
 public class FactoryTestStringMapWithoutIntConstructor implements StringMap {
+private static final long serialVersionUID = -3239395494628445052L;
 int initialCapacity;
 
 public FactoryTestStringMapWithoutIntConstructor() {



logging-log4j2 git commit: LOG4J2-1611 LOG4J2-1010 LOG4J2-1447 context injector should use ContextDataFactory; ContextDataFactory now supports pre-sizing

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master a22b7ae64 -> cceb1808d


LOG4J2-1611 LOG4J2-1010 LOG4J2-1447 context injector should use 
ContextDataFactory; ContextDataFactory now supports pre-sizing


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

Branch: refs/heads/master
Commit: cceb1808df85bdd0e0093a47cf8d010268532622
Parents: a22b7ae
Author: rpopma 
Authored: Sat Sep 24 01:56:27 2016 +0900
Committer: rpopma 
Committed: Sat Sep 24 01:56:27 2016 +0900

--
 .../log4j/core/impl/ContextDataFactory.java |  53 --
 .../core/impl/ThreadContextDataInjector.java|   7 +-
 ...actoryPropertySetMissingConstructorTest.java |  41 
 .../impl/ContextDataFactoryPropertySetTest.java |  52 ++
 .../log4j/core/impl/ContextDataFactoryTest.java |  47 +
 .../log4j/core/impl/FactoryTestStringMap.java   | 103 +++
 ...ctoryTestStringMapWithoutIntConstructor.java |  99 ++
 7 files changed, 392 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cceb1808/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
index 49d2b97..9b48dfd 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataFactory.java
@@ -16,11 +16,13 @@
  */
 package org.apache.logging.log4j.core.impl;
 
-import org.apache.logging.log4j.core.LogEvent;
+import java.lang.reflect.Constructor;
+
 import org.apache.logging.log4j.core.ContextDataInjector;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.apache.logging.log4j.util.SortedArrayStringMap;
 import org.apache.logging.log4j.util.StringMap;
-import org.apache.logging.log4j.util.PropertiesUtil;
 
 /**
  * Factory for creating the StringMap instances used to initialize LogEvents'
@@ -30,7 +32,8 @@ import org.apache.logging.log4j.util.PropertiesUtil;
  * 
  * By default returns {@code SortedArrayStringMap} objects. Can be configured 
by setting system property
  * {@code "log4j2.ContextData"} to the fully qualified class name of a class 
implementing the
- * {@code StringMap} interface. The class must have a public default 
constructor.
+ * {@code StringMap} interface. The class must have a public default 
constructor, and if possible should also have a
+ * public constructor that takes a single {@code int} argument for the initial 
capacity.
  * 
  *
  * @see LogEvent#getContextData()
@@ -39,15 +42,53 @@ import org.apache.logging.log4j.util.PropertiesUtil;
  * @since 2.7
  */
 public class ContextDataFactory {
+private static final String CLASS_NAME = 
PropertiesUtil.getProperties().getStringProperty("log4j2.ContextData");
+private static final Class CACHED_CLASS = createCachedClass(CLASS_NAME);
+private static final Constructor CACHED_CONSTRUCTOR = 
createCachedConstructor(CACHED_CLASS);
+
+private static Class createCachedClass(final String className) {
+if (className == null) {
+return null;
+}
+try {
+return Class.forName(className);
+} catch (final Exception any) {
+return null;
+}
+}
+
+private static Constructor createCachedConstructor(final Class 
cachedClass) {
+if (cachedClass == null) {
+return null;
+}
+try {
+return cachedClass.getDeclaredConstructor(int.class);
+} catch (final Exception any) {
+return null;
+}
+}
 
 @SuppressWarnings("unchecked")
 public static StringMap createContextData() {
-final String CLASS = 
PropertiesUtil.getProperties().getStringProperty("log4j2.ContextData",
-SortedArrayStringMap.class.getName());
+if (CACHED_CLASS == null) {
+return new SortedArrayStringMap();
+}
 try {
-return (StringMap) Class.forName(CLASS).newInstance();
+return (StringMap) CACHED_CLASS.newInstance();
 } catch (final Exception any) {
 return new SortedArrayStringMap();
 }
 }
+
+@SuppressWarnings("unchecked")
+public static StringMap createContextData(final int initialCapacity) {
+if 

logging-log4j2 git commit: LOG4J2-1611 LOG4J2-1010 ThreadContextDataInjector.ForDefaultThreadContextMap javadoc.

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 3c2aef1ce -> a22b7ae64


LOG4J2-1611 LOG4J2-1010 ThreadContextDataInjector.ForDefaultThreadContextMap 
javadoc.


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

Branch: refs/heads/master
Commit: a22b7ae647be633646159d3259c175200baaace1
Parents: 3c2aef1
Author: rpopma 
Authored: Sat Sep 24 00:57:19 2016 +0900
Committer: rpopma 
Committed: Sat Sep 24 00:57:19 2016 +0900

--
 .../logging/log4j/core/impl/ThreadContextDataInjector.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a22b7ae6/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
index 54fc06f..698d53a 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
@@ -62,11 +62,11 @@ public class ThreadContextDataInjector  {
  * specified reusable StringMap.
  *
  * @param props list of configuration properties, may be {@code null}
- * @param reusable a {@code StringMap} instance that may be reused to 
avoid creating temporary objects
+ * @param ignore a {@code StringMap} instance from the log event
  * @return a {@code StringMap} combining configuration properties with 
thread context data
  */
 @Override
-public StringMap injectContextData(final List props, final 
StringMap reusable) {
+public StringMap injectContextData(final List props, final 
StringMap ignore) {
 
 final Map copy = 
ThreadContext.getImmutableContext();
 



logging-log4j2 git commit: LOG4J2-1611 LOG4J2-1010 create pre-sized StringMap instances to avoid unnecessary copying.

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2ddd7e155 -> 3c2aef1ce


LOG4J2-1611 LOG4J2-1010 create pre-sized StringMap instances to avoid 
unnecessary copying.


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

Branch: refs/heads/master
Commit: 3c2aef1ce33fbdd4fb37f8e4bbf0583613895a00
Parents: 2ddd7e1
Author: rpopma 
Authored: Sat Sep 24 00:44:02 2016 +0900
Committer: rpopma 
Committed: Sat Sep 24 00:44:02 2016 +0900

--
 .../logging/log4j/core/impl/ThreadContextDataInjector.java  | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3c2aef1c/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
index 31d273b..54fc06f 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
@@ -24,6 +24,7 @@ import org.apache.logging.log4j.ThreadContextAccess;
 import org.apache.logging.log4j.core.ContextDataInjector;
 import org.apache.logging.log4j.core.config.Property;
 import org.apache.logging.log4j.util.ReadOnlyStringMap;
+import org.apache.logging.log4j.util.SortedArrayStringMap;
 import org.apache.logging.log4j.util.StringMap;
 import org.apache.logging.log4j.spi.ThreadContextMap;
 
@@ -81,7 +82,7 @@ public class ThreadContextDataInjector  {
 // data. Note that we cannot reuse the specified StringMap: some 
Loggers may have properties defined
 // and others not, so the LogEvent's context data may have been 
replaced with an immutable copy from
 // the ThreadContext - this will throw an 
UnsupportedOperationException if we try to modify it.
-final StringMap result = ContextDataFactory.createContextData();
+final StringMap result = new SortedArrayStringMap(props.size() + 
copy.size());
 copyProperties(props, result);
 copyThreadContextMap(copy, result);
 return result;
@@ -93,9 +94,7 @@ public class ThreadContextDataInjector  {
 if (map instanceof ReadOnlyStringMap) {
 return (ReadOnlyStringMap) map;
 }
-final StringMap result = ContextDataFactory.createContextData();
-copyThreadContextMap(ThreadContext.getImmutableContext(), result);
-return result;
+return map.isEmpty() ? EMPTY_STRING_MAP : new 
JdkMapAdapterStringMap(map.getImmutableMapOrNull());
 }
 
 /**
@@ -176,7 +175,7 @@ public class ThreadContextDataInjector  {
 // data. Note that we cannot reuse the specified StringMap: some 
Loggers may have properties defined
 // and others not, so the LogEvent's context data may have been 
replaced with an immutable copy from
 // the ThreadContext - this will throw an 
UnsupportedOperationException if we try to modify it.
-final StringMap result = ContextDataFactory.createContextData();
+final StringMap result = new SortedArrayStringMap(props.size() + 
immutableCopy.size());
 copyProperties(props, result);
 result.putAll(immutableCopy);
 return result;



logging-log4j2 git commit: LOG4J2-1611 LOG4J2-1010 Improved performance of context data injector for web applications to be on par with standalone applications.

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 006706615 -> 2ddd7e155


LOG4J2-1611 LOG4J2-1010 Improved performance of context data injector for web 
applications to be on par with standalone applications.


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

Branch: refs/heads/master
Commit: 2ddd7e1552dfe428b7d2e09079fbfd2ce190876b
Parents: 0067066
Author: rpopma 
Authored: Fri Sep 23 22:59:51 2016 +0900
Committer: rpopma 
Committed: Fri Sep 23 22:59:51 2016 +0900

--
 .../log4j/core/impl/JdkMapAdapterStringMap.java | 111 +++
 .../core/impl/ThreadContextDataInjector.java|  35 --
 src/changes/changes.xml |   3 +
 3 files changed, 140 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2ddd7e15/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/JdkMapAdapterStringMap.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/JdkMapAdapterStringMap.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/JdkMapAdapterStringMap.java
new file mode 100644
index 000..b9387b9a
--- /dev/null
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/JdkMapAdapterStringMap.java
@@ -0,0 +1,111 @@
+/*
+ * 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.core.impl;
+
+import java.util.Map;
+
+import org.apache.logging.log4j.util.BiConsumer;
+import org.apache.logging.log4j.util.ReadOnlyStringMap;
+import org.apache.logging.log4j.util.StringMap;
+import org.apache.logging.log4j.util.TriConsumer;
+
+/**
+ * Provides a read-only {@code StringMap} view of a {@code Map}.
+ */
+class JdkMapAdapterStringMap implements StringMap {
+private static final long serialVersionUID = -7348247784983193612L;
+private Map map;
+
+public JdkMapAdapterStringMap(final Map map) {
+this.map = map;
+}
+
+@Override
+public Map toMap() {
+return map;
+}
+
+@Override
+public boolean containsKey(final String key) {
+return map.containsKey(key);
+}
+
+@SuppressWarnings("unchecked")
+@Override
+public  void forEach(final BiConsumer action) {
+for (Map.Entry entry : map.entrySet()) {
+action.accept(entry.getKey(), (V) entry.getValue());
+}
+}
+
+@SuppressWarnings("unchecked")
+@Override
+public  void forEach(final TriConsumer action, 
final S state) {
+for (Map.Entry entry : map.entrySet()) {
+action.accept(entry.getKey(), (V) entry.getValue(), state);
+}
+}
+
+@SuppressWarnings("unchecked")
+@Override
+public  V getValue(final String key) {
+return (V) map.get(key);
+}
+
+@Override
+public boolean isEmpty() {
+return map.isEmpty();
+}
+
+@Override
+public int size() {
+return map.size();
+}
+
+@Override
+public void clear() {
+fail();
+}
+
+@Override
+public void freeze() {
+}
+
+@Override
+public boolean isFrozen() {
+return true;
+}
+
+@Override
+public void putAll(final ReadOnlyStringMap source) {
+fail();
+}
+
+@Override
+public void putValue(final String key, final Object value) {
+fail();
+}
+
+@Override
+public void remove(final String key) {
+fail();
+}
+
+private void fail() {
+throw new UnsupportedOperationException("This is a read-only data 
structure");
+}
+}


[1/2] logging-log4j2 git commit: LOG4J2-1010 bugfix in ThreadContextDataInjector.ForCopyOnWriteThreadContext: prevent potential UnsupportedOperationException when using async loggers and some loggers

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 713f1a9ba -> 006706615


LOG4J2-1010 bugfix in ThreadContextDataInjector.ForCopyOnWriteThreadContext: 
prevent potential UnsupportedOperationException when using async loggers and 
some loggers have properties configured and some don't


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

Branch: refs/heads/master
Commit: 281ad99a011b1952c721e5f3063fc1dc639f1716
Parents: 713f1a9
Author: rpopma 
Authored: Fri Sep 23 17:48:46 2016 +0900
Committer: rpopma 
Committed: Fri Sep 23 17:48:46 2016 +0900

--
 .../log4j/core/impl/ThreadContextDataInjector.java | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/281ad99a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
index d26324c..92144c4 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
@@ -144,22 +144,25 @@ public class ThreadContextDataInjector  {
  * specified reusable StringMap.
  *
  * @param props list of configuration properties, may be {@code null}
- * @param reusable a {@code StringMap} instance that may be reused to 
avoid creating temporary objects
+ * @param ignore a {@code StringMap} instance from the log event
  * @return a {@code StringMap} combining configuration properties with 
thread context data
  */
 @Override
-public StringMap injectContextData(final List props, final 
StringMap reusable) {
+public StringMap injectContextData(final List props, final 
StringMap ignore) {
 // If there are no configuration properties we want to just return 
the ThreadContext's StringMap:
 // it is a copy-on-write data structure so we are sure 
ThreadContext changes will not affect our copy.
 final StringMap immutableCopy = 
ThreadContextAccess.getThreadContextMap2().getReadOnlyContextData();
 if (props == null || props.isEmpty()) {
-return immutableCopy;
+return immutableCopy; // this will replace the LogEvent's 
context data with the returned instance
 }
 // However, if the list of Properties is non-empty we need to 
combine the properties and the ThreadContext
-// data. In that case we will copy the key-value pairs into the 
specified reusable StringMap.
-copyProperties(props, reusable);
-reusable.putAll(immutableCopy);
-return reusable;
+// data. Note that we cannot reuse the specified StringMap: some 
Loggers may have properties defined
+// and others not, so the LogEvent's context data may have been 
replaced with an immutable copy from
+// the ThreadContext - this will throw an 
UnsupportedOperationException if we try to modify it.
+final StringMap result = ContextDataFactory.createContextData();
+copyProperties(props, result);
+result.putAll(immutableCopy);
+return result;
 }
 
 @Override



logging-log4j2 git commit: LOG4J2-1010 better javadoc for ContextDataInjectorFactory

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 42da9595b -> 713f1a9ba


LOG4J2-1010 better javadoc for ContextDataInjectorFactory


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

Branch: refs/heads/master
Commit: 713f1a9bac5a7cd15805a7e188178adc362ff2c0
Parents: 42da959
Author: rpopma 
Authored: Fri Sep 23 17:32:01 2016 +0900
Committer: rpopma 
Committed: Fri Sep 23 17:32:01 2016 +0900

--
 .../apache/logging/log4j/core/impl/ContextDataInjectorFactory.java | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/713f1a9b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
index 6af517d..4dcacbc 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ContextDataInjectorFactory.java
@@ -58,6 +58,8 @@ public class ContextDataInjectorFactory {
  * 
  *
  * @return a ContextDataInjector that populates the {@code 
ReadOnlyStringMap} of all {@code LogEvent} objects
+ * @see LogEvent#getContextData()
+ * @see ContextDataInjector
  */
 public static ContextDataInjector createInjector() {
 final String className = 
PropertiesUtil.getProperties().getStringProperty("log4j2.ContextDataInjector");



logging-log4j2 git commit: LOG4J2-1010 even better javadoc for LogEvent::getContextData

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master bb220a0cb -> 42da9595b


LOG4J2-1010 even better javadoc for LogEvent::getContextData


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

Branch: refs/heads/master
Commit: 42da9595b9cafbba3c7e033d66ab49cc6f1c5aa5
Parents: bb220a0
Author: rpopma 
Authored: Fri Sep 23 17:18:39 2016 +0900
Committer: rpopma 
Committed: Fri Sep 23 17:18:39 2016 +0900

--
 .../src/main/java/org/apache/logging/log4j/core/LogEvent.java | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/42da9595/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
index 677e9e7..1b608b9 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
@@ -61,9 +61,10 @@ public interface LogEvent extends Serializable {
  * Returns the {@code ReadOnlyStringMap} object holding context data 
key-value pairs.
  * 
  * Context data (also known as Mapped Diagnostic Context or MDC) is data 
that is set by the application to be
- * included in all subsequent log events. The default source for context 
data is the {@link ThreadContext},
- * but users can configure a custom {@link ContextDataInjector} to obtain 
key-value pairs from any arbitrary
- * source.
+ * included in all subsequent log events. The default source for context 
data is the {@link ThreadContext} (and
+ * https://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution;>properties
+ * configured on the Logger that logged the event), but users can 
configure a custom {@link ContextDataInjector}
+ * to inject key-value pairs from any arbitrary source.
  *
  * @return the {@code ReadOnlyStringMap} object holding context data 
key-value pairs
  * @see ContextDataInjector



[1/2] logging-log4j2 git commit: LOG4J2-1010 better javadoc for LogEvent::getContextData

2016-09-23 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master b0ac23b35 -> bb220a0cb


LOG4J2-1010 better javadoc for LogEvent::getContextData


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

Branch: refs/heads/master
Commit: 49321dd3d620035c39448a050654b47db95f529b
Parents: 23731de
Author: rpopma 
Authored: Fri Sep 23 17:11:54 2016 +0900
Committer: rpopma 
Committed: Fri Sep 23 17:11:54 2016 +0900

--
 .../main/java/org/apache/logging/log4j/core/LogEvent.java| 8 
 1 file changed, 8 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49321dd3/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
index 77523ba..677e9e7 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LogEvent.java
@@ -59,7 +59,15 @@ public interface LogEvent extends Serializable {
 
 /**
  * Returns the {@code ReadOnlyStringMap} object holding context data 
key-value pairs.
+ * 
+ * Context data (also known as Mapped Diagnostic Context or MDC) is data 
that is set by the application to be
+ * included in all subsequent log events. The default source for context 
data is the {@link ThreadContext},
+ * but users can configure a custom {@link ContextDataInjector} to obtain 
key-value pairs from any arbitrary
+ * source.
+ *
  * @return the {@code ReadOnlyStringMap} object holding context data 
key-value pairs
+ * @see ContextDataInjector
+ * @see ThreadContext
  * @since 2.7
  */
 ReadOnlyStringMap getContextData();



[2/2] logging-log4j2 git commit: Merge remote-tracking branch 'origin/master'

2016-09-23 Thread rpopma
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/master
Commit: bb220a0cb09523d5a2c129089d5cd114a80d0afb
Parents: 49321dd b0ac23b
Author: rpopma 
Authored: Fri Sep 23 17:13:38 2016 +0900
Committer: rpopma 
Committed: Fri Sep 23 17:13:38 2016 +0900

--
 .../log4j/config/Log4j1ConfigurationParser.java | 23 ++--
 log4j-core/src/main/resources/Log4j-config.xsd  |  2 +-
 src/changes/changes.xml |  3 +++
 3 files changed, 15 insertions(+), 13 deletions(-)
--




logging-log4j2 git commit: Closes #43.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 383135357 -> b0ac23b35


Closes #43.

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

Branch: refs/heads/master
Commit: b0ac23b35f2d430e8c4ac7c3e10ddb2115044157
Parents: 3831353
Author: Gary Gregory 
Authored: Fri Sep 23 00:28:39 2016 -0700
Committer: Gary Gregory 
Committed: Fri Sep 23 00:28:39 2016 -0700

--
 src/changes/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b0ac23b3/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8a727c0..c855ec7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -175,7 +175,7 @@
 Redo hashCode() and equals() methods in 
org.apache.logging.log4j.core.net.ssl classes.
   
   
-Add targetNamespace to log4j-config.xsd.
+Add targetNamespace to log4j-config.xsd. GitHub #43.
   
   
 RoutingAppender can be configured with scripts. Add Script in a Routes 
element.



logging-log4j2 git commit: Clarify Javadocs.

2016-09-23 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 679c4aba6 -> 383135357


Clarify 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/38313535
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/38313535
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/38313535

Branch: refs/heads/master
Commit: 3831353570467885f1bddf10d286e6b2b609423c
Parents: 679c4ab
Author: Gary Gregory 
Authored: Thu Sep 22 23:35:19 2016 -0700
Committer: Gary Gregory 
Committed: Thu Sep 22 23:35:19 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java | 23 ++--
 1 file changed, 11 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/38313535/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
--
diff --git 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
index 16c9b7c..d71349e 100644
--- 
a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
+++ 
b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java
@@ -73,18 +73,17 @@ public class Log4j1ConfigurationParser {
private final ConfigurationBuilder builder = 
ConfigurationBuilderFactory
.newConfigurationBuilder();
 
-   /**
-* Parse a Log4j 1.2 properties configuration file into a
-* ConfigurationBuilder.
-*
-* @param input
-*InputStream to read from, will not be closed.
-* @return the populated ConfigurationBuilder, never {@literal null}
-* @throws IOException
-* if unable to read the input
-* @throws ConfigurationException
-* if the input does not contain a valid configuration
-*/
+/**
+ * Parses a Log4j 1.2 properties configuration file in ISO 8859-1 encoding 
into a ConfigurationBuilder.
+ *
+ * @param input
+ *InputStream to read from is assumed to be ISO 8859-1, and 
will not be closed.
+ * @return the populated ConfigurationBuilder, never {@literal null}
+ * @throws IOException
+ * if unable to read the input
+ * @throws ConfigurationException
+ * if the input does not contain a valid configuration
+ */
public ConfigurationBuilder 
buildConfigurationBuilder(final InputStream input)
throws IOException {
properties.load(input);