logging-log4j2 git commit: Rename pname (forgot to do this in previous commit).

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master a75e9cc71 -> 87ad694e6


Rename pname (forgot to do this in previous 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/87ad694e
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/87ad694e
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/87ad694e

Branch: refs/heads/master
Commit: 87ad694e67625e1eef5014f7b29e46f6bef41ca0
Parents: a75e9cc
Author: Gary Gregory 
Authored: Wed Sep 21 10:25:12 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 10:25:12 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87ad694e/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
index a8ba374..b32f9d0 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
@@ -30,9 +30,9 @@ public class ConfiguratonFileWatcher implements FileWatcher {
 private final Reconfigurable reconfigurable;
 private final List configurationListeners;
 
-public ConfiguratonFileWatcher(final Reconfigurable reconfigurable, final 
List listeners) {
+public ConfiguratonFileWatcher(final Reconfigurable reconfigurable, final 
List configurationListeners) {
 this.reconfigurable = reconfigurable;
-this.configurationListeners = listeners;
+this.configurationListeners = configurationListeners;
 }
 
 public List getListeners() {



logging-log4j2 git commit: Fix Javadoc.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 87ad694e6 -> d2b47030b


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

Branch: refs/heads/master
Commit: d2b47030be23dfd25b8721dca649e27579cac761
Parents: 87ad694
Author: Gary Gregory 
Authored: Wed Sep 21 10:25:56 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 10:25:56 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d2b47030/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java
index 1ae64a3..4fd382a 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/FileWatcher.java
@@ -19,7 +19,7 @@ package org.apache.logging.log4j.core.util;
 import java.io.File;
 
 /**
- * Watches for changes in a Path and performs an action when the file is 
modified.
+ * Watches for changes in a File and performs an action when the file is 
modified.
  */
 public interface FileWatcher {
 



logging-log4j2 git commit: No need to call File.toString() to pass to the status logger.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 5a8ff8f4e -> 044ea14c4


No need to call File.toString() to pass to the status logger.

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

Branch: refs/heads/master
Commit: 044ea14c47bb0fb293da23702e0b79a550d54f1f
Parents: 5a8ff8f
Author: Gary Gregory 
Authored: Wed Sep 21 10:31:36 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 10:31:36 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/044ea14c/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
index 7b05aa1..b0c6080 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
@@ -98,7 +98,7 @@ public class WatchManager extends AbstractLifeCycle {
 final FileMonitor fileMonitor = entry.getValue();
 final long lastModfied = file.lastModified();
 if (fileModified(fileMonitor, lastModfied)) {
-logger.info("File {} was modified", file.toString());
+logger.info("File {} was modified", file);
 fileMonitor.lastModified = lastModfied;
 fileMonitor.fileWatcher.fileModified(file);
 }



logging-log4j2 git commit: [LOG4J2-1259] Log4j threads are leaking on Tomcat shutdown.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 95cc02a51 -> 19832cf09


[LOG4J2-1259] Log4j threads are leaking on Tomcat shutdown.

Use the LifeCycle2.stop(long, TimeUnit) API to shutdown Log4j in the Web
module. Before this code, I am thinking that when the container shuts
down log4j and unloads the classes, some Log4j  code is left running and
causes problems like "Could not load
org.apache.logging.log4j.core.config.ConfiguratonFileWatcher$ReconfigurationWorker."
described in
https://issues.apache.org/jira/browse/LOG4J2-1259?focusedCommentId=15510324=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15510324
This commit adds two servlet init parameters called "log4j.stop.timeout"
and "log4j.stop.timeout.timeunit" with defaults of 30 and
TimeUnit.SECONDS.

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

Branch: refs/heads/master
Commit: 19832cf09962a73d1f3541c42719f9d9da1f41e8
Parents: 95cc02a
Author: Gary Gregory 
Authored: Wed Sep 21 11:01:32 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 11:01:32 2016 -0700

--
 .../log4j/web/Log4jServletContextListener.java  | 42 +++-
 1 file changed, 32 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/19832cf0/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContextListener.java
--
diff --git 
a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContextListener.java
 
b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContextListener.java
index f4afaba..4a65d92 100644
--- 
a/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContextListener.java
+++ 
b/log4j-web/src/main/java/org/apache/logging/log4j/web/Log4jServletContextListener.java
@@ -16,12 +16,17 @@
  */
 package org.apache.logging.log4j.web;
 
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
 import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LifeCycle2;
 import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.Strings;
 
 /**
  * In environments older than Servlet 3.0, this initializer is responsible for 
starting up Log4j logging before anything
@@ -30,7 +35,13 @@ import org.apache.logging.log4j.status.StatusLogger;
  */
 public class Log4jServletContextListener implements ServletContextListener {
 
-private static final Logger LOGGER = StatusLogger.getLogger();
+   private static final int DEFAULT_STOP_TIMEOUT = 30;
+private static final TimeUnit DEFAULT_STOP_TIMEOUT_TIMEUNIT = 
TimeUnit.SECONDS;
+
+   private static final String KEY_STOP_TIMEOUT = "log4j.stop.timeout";
+   private static final String KEY_STOP_TIMEOUT_TIMEUNIT = 
"log4j.stop.timeout.timeunit";
+
+   private static final Logger LOGGER = StatusLogger.getLogger();
 
 private ServletContext servletContext;
 private Log4jWebLifeCycle initializer;
@@ -50,14 +61,25 @@ public class Log4jServletContextListener implements 
ServletContextListener {
 }
 
 @Override
-public void contextDestroyed(final ServletContextEvent event) {
-if (this.servletContext == null || this.initializer == null) {
-LOGGER.warn("Context destroyed before it was initialized.");
-return;
-}
-LOGGER.debug("Log4jServletContextListener ensuring that Log4j shuts 
down properly.");
+   public void contextDestroyed(final ServletContextEvent event) {
+   if (this.servletContext == null || this.initializer == null) {
+   LOGGER.warn("Context destroyed before it was 
initialized.");
+   return;
+   }
+   LOGGER.debug("Log4jServletContextListener ensuring that Log4j 
shuts down properly.");
 
-this.initializer.clearLoggerContext(); // the application is finished 
shutting down now
-this.initializer.stop();
-}
+   this.initializer.clearLoggerContext(); // the application is 
finished
+   // shutting down now
+   if (initializer instanceof LifeCycle2) {
+   final String stopTimeoutStr = 
servletContext.getInitParameter(KEY_STOP_TIMEOUT);
+   final long stopTimeout = 
Strings.isEmpty(stopTimeoutStr) ? DEFAULT_STOP_TIMEOUT
+   : 

logging-log4j2 git commit: Rename private some private ivars.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 00b99a17d -> a75e9cc71


Rename private some private ivars.

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

Branch: refs/heads/master
Commit: a75e9cc7176abca3481ec4bd42afa985ca2c04f6
Parents: 00b99a1
Author: Gary Gregory 
Authored: Wed Sep 21 10:24:17 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 10:24:17 2016 -0700

--
 .../log4j/core/config/ConfiguratonFileWatcher.java| 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a75e9cc7/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
index 38a686a..a8ba374 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfiguratonFileWatcher.java
@@ -28,22 +28,22 @@ import org.apache.logging.log4j.core.util.FileWatcher;
 public class ConfiguratonFileWatcher implements FileWatcher {
 
 private final Reconfigurable reconfigurable;
-private final List configurationListener;
+private final List configurationListeners;
 
 public ConfiguratonFileWatcher(final Reconfigurable reconfigurable, final 
List listeners) {
 this.reconfigurable = reconfigurable;
-this.configurationListener = listeners;
+this.configurationListeners = listeners;
 }
 
 public List getListeners() {
-return configurationListener;
+return configurationListeners;
 }
 
 
 @Override
 public void fileModified(final File file) {
-for (final ConfigurationListener listener : configurationListener) {
-LoggerContext.getContext(false).submitDaemon(new 
ReconfigurationRunnable(listener, reconfigurable));
+for (final ConfigurationListener configurationListener : 
configurationListeners) {
+LoggerContext.getContext(false).submitDaemon(new 
ReconfigurationRunnable(configurationListener, reconfigurable));
 }
 }
 



logging-log4j2 git commit: Rename private class.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master d2b47030b -> 5a8ff8f4e


Rename private class.

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

Branch: refs/heads/master
Commit: 5a8ff8f4edd343129f0eaa13719209d1fa38e166
Parents: d2b4703
Author: Gary Gregory 
Authored: Wed Sep 21 10:30:31 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 10:30:31 2016 -0700

--
 .../java/org/apache/logging/log4j/core/util/WatchManager.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5a8ff8f4/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
index 95bf564..7b05aa1 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
@@ -63,7 +63,7 @@ public class WatchManager extends AbstractLifeCycle {
 public void start() {
 super.start();
 if (intervalSeconds > 0) {
-future = scheduler.scheduleWithFixedDelay(new WatchWorker(), 
intervalSeconds, intervalSeconds,
+future = scheduler.scheduleWithFixedDelay(new WatchRunnable(), 
intervalSeconds, intervalSeconds,
 TimeUnit.SECONDS);
 }
 }
@@ -89,7 +89,7 @@ public class WatchManager extends AbstractLifeCycle {
 return map;
 }
 
-private class WatchWorker implements Runnable {
+private class WatchRunnable implements Runnable {
 
 @Override
 public void run() {



logging-log4j2 git commit: Better status logger message.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 044ea14c4 -> 95cc02a51


Better status logger 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/95cc02a5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/95cc02a5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/95cc02a5

Branch: refs/heads/master
Commit: 95cc02a51db05119b5d46383e1a4af2479e72a36
Parents: 044ea14
Author: Gary Gregory 
Authored: Wed Sep 21 10:33:09 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 10:33:09 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/95cc02a5/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
index b0c6080..df8 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/WatchManager.java
@@ -98,7 +98,7 @@ public class WatchManager extends AbstractLifeCycle {
 final FileMonitor fileMonitor = entry.getValue();
 final long lastModfied = file.lastModified();
 if (fileModified(fileMonitor, lastModfied)) {
-logger.info("File {} was modified", file);
+logger.info("File {} was modified on {}, previous 
modification was {}", file, lastModfied, fileMonitor.lastModified);
 fileMonitor.lastModified = lastModfied;
 fileMonitor.fileWatcher.fileModified(file);
 }



logging-log4j2 git commit: Fix status logger messages.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 19832cf09 -> c8ee4b3b6


Fix status logger messages.

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

Branch: refs/heads/master
Commit: c8ee4b3b6ee93208322e0a8cd4a12ce97ecf0752
Parents: 19832cf
Author: Gary Gregory 
Authored: Wed Sep 21 12:15:12 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 12:15:12 2016 -0700

--
 .../main/java/org/apache/logging/log4j/core/LoggerContext.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c8ee4b3b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index 8cf9520..1f99941 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -506,7 +506,7 @@ public class LoggerContext extends AbstractLifeCycle
  */
 private Configuration setConfiguration(final Configuration config) {
 if (config == null) {
-LOGGER.error("No configuration found for context '%s'.", 
contextName);
+LOGGER.error("No configuration found for context '{}'.", 
contextName);
 // No change, return the current configuration.
 return this.configuration;
 }
@@ -597,7 +597,7 @@ public class LoggerContext extends AbstractLifeCycle
 contextName, configURI, this, cl);
 final Configuration instance = 
ConfigurationFactory.getInstance().getConfiguration(this, contextName, 
configURI, cl);
 if (instance == null) {
-LOGGER.error("Reconfiguration failed: No configuration found for 
'%s' at '%s' in '%s'", contextName, configURI, cl);
+LOGGER.error("Reconfiguration failed: No configuration found for 
'{}' at '{}' in '{}'", contextName, configURI, cl);
 } else {
 setConfiguration(instance);
 /*



logging-log4j2 git commit: Refactor properties ivar access.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 1815dab40 -> 518ff5645


Refactor properties ivar access.

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

Branch: refs/heads/master
Commit: 518ff56457599b310b952e0c115c025b50745513
Parents: 1815dab
Author: Gary Gregory 
Authored: Wed Sep 21 20:51:23 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 20:51:23 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/518ff564/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 0d5be53..f529049 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
@@ -328,16 +328,24 @@ public class Log4j1ConfigurationParser {
}
 
private String getLog4jAppenderValue(final String appenderName, final 
String attributeName) {
-   return properties.getProperty("log4j.appender." + appenderName 
+ "." + attributeName);
+   return getProperty("log4j.appender." + appenderName + "." + 
attributeName);
+   }
+
+   private String getProperty(final String key) {
+   return properties.getProperty(key);
+   }
+
+   private String getProperty(final String key, String defaultValue) {
+   return properties.getProperty(key, defaultValue);
}
 
private String getLog4jAppenderValue(final String appenderName, final 
String attributeName,
final String defaultValue) {
-   return properties.getProperty("log4j.appender." + appenderName 
+ "." + attributeName, defaultValue);
+   return getProperty("log4j.appender." + appenderName + "." + 
attributeName, defaultValue);
}
 
private String getLog4jValue(final String key) {
-   return properties.getProperty("log4j." + key);
+   return getProperty("log4j." + key);
}
 
private void reportWarning(final String msg) {



logging-log4j2 git commit: [LOG4J2-1604] Log4j2 TcpSocketServer in background. Docs.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master ee87a184c -> fe7a0a805


[LOG4J2-1604] Log4j2 TcpSocketServer in background. Docs.

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

Branch: refs/heads/master
Commit: fe7a0a8051fe628fc97a574b5fdc99efd0fb5f4c
Parents: ee87a18
Author: Gary Gregory 
Authored: Wed Sep 21 18:00:19 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 18:00:19 2016 -0700

--
 src/site/xdoc/runtime-dependencies.xml | 7 +++
 1 file changed, 7 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fe7a0a80/src/site/xdoc/runtime-dependencies.xml
--
diff --git a/src/site/xdoc/runtime-dependencies.xml 
b/src/site/xdoc/runtime-dependencies.xml
index b4b2368..29c2015 100644
--- a/src/site/xdoc/runtime-dependencies.xml
+++ b/src/site/xdoc/runtime-dependencies.xml
@@ -138,6 +138,13 @@
 files COPYING and COPYING.LESSER 
included with the JeroMQ distribution.
   
 
+
+  TcpSocketServer and UdpSocketServer
+  
+TcpSocketServer and UdpSocketServer use the http://www.jcommander.org/;>JCommander library 
+which is licensed under the terms of the Apache License version 
2.0.
+  
+
   
 
   



[6/8] logging-log4j2 git commit: LOG4J2-1010 LOG4J2-1447 cleaner context injection code now that ThreadContextMap2 is a MutableContextDataSupplier

2016-09-21 Thread rpopma
LOG4J2-1010 LOG4J2-1447 cleaner context injection code now that 
ThreadContextMap2 is a MutableContextDataSupplier


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

Branch: refs/heads/master
Commit: 046198901839a31b77436759ec354c183e54a25a
Parents: 09eb4f4
Author: rpopma 
Authored: Thu Sep 22 11:02:54 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 11:02:54 2016 +0900

--
 .../org/apache/logging/log4j/ThreadContextAccess.java  | 13 +
 .../log4j/core/impl/ContextDataInjectorFactory.java|  6 +++---
 .../log4j/core/impl/ThreadContextDataInjector.java | 11 ---
 3 files changed, 20 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/04619890/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java 
b/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java
index 2e2a992..c5c33de 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/ThreadContextAccess.java
@@ -18,6 +18,7 @@
 package org.apache.logging.log4j;
 
 import org.apache.logging.log4j.spi.ThreadContextMap;
+import org.apache.logging.log4j.spi.ThreadContextMap2;
 
 /**
  * This class is intended for internal log4j2 usage and should not be used 
directly by applications.
@@ -43,4 +44,16 @@ public final class ThreadContextAccess {
 public static ThreadContextMap getThreadContextMap() {
 return ThreadContext.getThreadContextMap();
 }
+
+/**
+ * Returns the internal data structure used to store thread context 
key-value pairs.
+ * 
+ * This method is intended for internal log4j2 usage.
+ * The returned data structure is not intended to be used directly by 
applications.
+ * 
+ * @return the internal data structure used to store thread context 
key-value pairs
+ */
+public static ThreadContextMap2 getThreadContextMap2() {
+return (ThreadContextMap2) ThreadContext.getThreadContextMap();
+}
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/04619890/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 31e1013..eb1e0ce 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
@@ -21,8 +21,8 @@ import org.apache.logging.log4j.core.ContextDataInjector;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.spi.ContextData;
 import org.apache.logging.log4j.spi.CopyOnWrite;
-import org.apache.logging.log4j.spi.MutableContextDataSupplier;
 import org.apache.logging.log4j.spi.ThreadContextMap;
+import org.apache.logging.log4j.spi.ThreadContextMap2;
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.LoaderUtil;
 import org.apache.logging.log4j.util.PropertiesUtil;
@@ -79,10 +79,10 @@ public class ContextDataInjectorFactory {
 
 private static ContextDataInjector createDefaultInjector() {
 final ThreadContextMap threadContextMap = 
ThreadContextAccess.getThreadContextMap();
-if (threadContextMap instanceof CopyOnWrite && threadContextMap 
instanceof MutableContextDataSupplier) {
+if (threadContextMap instanceof CopyOnWrite && threadContextMap 
instanceof ThreadContextMap2) {
 return new 
ThreadContextDataInjector.ForCopyOnWriteMutableThreadContextMap();
 }
-if (threadContextMap instanceof MutableContextDataSupplier) {
+if (threadContextMap instanceof ThreadContextMap2) {
 return new 
ThreadContextDataInjector.ForGarbageFreeMutableThreadContextMap();
 }
 return new ThreadContextDataInjector.ForDefaultThreadContextMap();

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/04619890/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.java
--
diff --git 

[5/8] logging-log4j2 git commit: LOG4J2-1447 change the contract of ThreadContextMap2 to include the role of MutableContextDataSupplier

2016-09-21 Thread rpopma
LOG4J2-1447 change the contract of ThreadContextMap2 to include the role of 
MutableContextDataSupplier


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

Branch: refs/heads/master
Commit: 09eb4f4483600bc2f9d29052bb8589dc10b8d858
Parents: e1b86f5
Author: rpopma 
Authored: Thu Sep 22 11:01:26 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 11:01:26 2016 +0900

--
 .../org/apache/logging/slf4j/MDCContextMap.java | 20 
 1 file changed, 20 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/09eb4f44/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
--
diff --git 
a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java 
b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
index 5202ca7..0593e3c 100644
--- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
+++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
@@ -19,7 +19,9 @@ package org.apache.logging.slf4j;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.apache.logging.log4j.spi.MutableContextData;
 import org.apache.logging.log4j.spi.ThreadContextMap2;
+import org.apache.logging.log4j.util.ArrayContextData;
 import org.slf4j.MDC;
 
 /**
@@ -27,6 +29,11 @@ import org.slf4j.MDC;
  */
 public class MDCContextMap implements ThreadContextMap2 {
 
+private static final MutableContextData EMPTY_CONTEXT_DATA = new 
ArrayContextData();
+static {
+EMPTY_CONTEXT_DATA.freeze();
+}
+
 @Override
 public void put(final String key, final String value) {
 MDC.put(key, value);
@@ -75,4 +82,17 @@ public class MDCContextMap implements ThreadContextMap2 {
 public boolean isEmpty() {
 return MDC.getCopyOfContextMap().isEmpty();
 }
+
+@Override
+public MutableContextData getMutableContextData() {
+final Map copy = getCopy();
+if (copy.isEmpty()) {
+return EMPTY_CONTEXT_DATA;
+}
+final MutableContextData result = new ArrayContextData();
+for (Entry entry : copy.entrySet()) {
+result.putValue(entry.getKey(), entry.getValue());
+}
+return result;
+}
 }



[4/8] logging-log4j2 git commit: LOG4J2-1447 change the contract of ThreadContextMap2 to include the role of MutableContextDataSupplier

2016-09-21 Thread rpopma
LOG4J2-1447 change the contract of ThreadContextMap2 to include the role of 
MutableContextDataSupplier


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

Branch: refs/heads/master
Commit: e1b86f515e6f97866fa2e6ff8a3ba054c315a934
Parents: fc68248
Author: rpopma 
Authored: Thu Sep 22 11:01:04 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 11:01:04 2016 +0900

--
 .../src/main/java/org/apache/logging/log4j/ThreadContext.java | 3 +++
 .../org/apache/logging/log4j/spi/DefaultThreadContextMap.java | 3 +--
 .../main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e1b86f51/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
--
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
index 4636469..f282397 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 
 import org.apache.logging.log4j.message.ParameterizedMessage;
+import org.apache.logging.log4j.spi.DefaultThreadContextMap;
 import org.apache.logging.log4j.spi.DefaultThreadContextStack;
 import org.apache.logging.log4j.spi.NoOpThreadContextMap;
 import org.apache.logging.log4j.spi.ThreadContextMap;
@@ -249,6 +250,8 @@ public final class ThreadContext {
 public static void putAll(final Map m) {
 if (contextMap instanceof ThreadContextMap2) {
 ((ThreadContextMap2) contextMap).putAll(m);
+} else if (contextMap instanceof DefaultThreadContextMap) {
+((DefaultThreadContextMap) contextMap).putAll(m);
 } else {
 for (final Map.Entry entry: m.entrySet()) {
 contextMap.put(entry.getKey(), entry.getValue());

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e1b86f51/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
--
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
index 1c01c0b..143c2e1 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
@@ -30,7 +30,7 @@ import org.apache.logging.log4j.util.TriConsumer;
  * expected that the Map will be passed to many more log events than the 
number of keys it contains the performance
  * should be much better than if the Map was copied for each event.
  */
-public class DefaultThreadContextMap implements ThreadContextMap2, ContextData 
{
+public class DefaultThreadContextMap implements ThreadContextMap, ContextData {
 
 /**
  * Property name ({@value} ) for selecting {@code InheritableThreadLocal} 
(value "true") or plain
@@ -80,7 +80,6 @@ public class DefaultThreadContextMap implements 
ThreadContextMap2, ContextData {
 localMap.set(Collections.unmodifiableMap(map));
 }
 
-@Override
 public void putAll(final Map m) {
 if (!useMap) {
 return;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e1b86f51/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
--
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
index 4def1b3..6f831c3 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/ThreadContextMap2.java
@@ -25,7 +25,7 @@ import java.util.Map;
  * @see ThreadContextMap
  * @since 2.7
  */
-public interface ThreadContextMap2 extends ThreadContextMap {
+public interface ThreadContextMap2 extends ThreadContextMap, 
MutableContextDataSupplier {
 
 /**
  * Puts all given context map entries into the current thread's



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

2016-09-21 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/16e7ef70
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/16e7ef70
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/16e7ef70

Branch: refs/heads/master
Commit: 16e7ef70ca44e0f403951fa9491ff3506139ee62
Parents: 3ed968e 215d934
Author: rpopma 
Authored: Thu Sep 22 11:04:18 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 11:04:18 2016 +0900

--
 log4j-core/pom.xml  |   6 +
 .../core/net/server/AbstractSocketServer.java   |  93 +-
 .../log4j/core/net/server/TcpSocketServer.java  | 180 ---
 .../log4j/core/net/server/UdpSocketServer.java  |  83 -
 .../log4j/core/util/InetAddressConverter.java   |  19 ++
 log4j-core/src/test/resources/log4j-console.xml |  29 +++
 pom.xml |   5 +
 src/changes/changes.xml |   3 +
 src/site/xdoc/runtime-dependencies.xml  |  12 +-
 9 files changed, 317 insertions(+), 113 deletions(-)
--




[2/8] logging-log4j2 git commit: LOG4J2-1447 clarified in javadoc that returned object may be read-only

2016-09-21 Thread rpopma
LOG4J2-1447 clarified in javadoc that returned object may be read-only


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

Branch: refs/heads/master
Commit: ca9d5e09a3a5f4bf5a969b2225934e5e58dac134
Parents: 4e4d133
Author: rpopma 
Authored: Thu Sep 22 10:52:48 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 10:52:48 2016 +0900

--
 .../apache/logging/log4j/spi/MutableContextDataSupplier.java | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ca9d5e09/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableContextDataSupplier.java
--
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableContextDataSupplier.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableContextDataSupplier.java
index 7afdeaa..3f242ed 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableContextDataSupplier.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableContextDataSupplier.java
@@ -18,13 +18,19 @@ package org.apache.logging.log4j.spi;
 
 /**
  * Interface for objects that know how to provide a {@code MutableContextData} 
object.
+ * 
+ * This interface offers no guarantee that the returned context data is 
actually mutable; it may have been
+ * {@linkplain MutableContextData#freeze() frozen}, making the data structure 
read-only.
+ * 
  *
  * @since 2.7
  */
 public interface MutableContextDataSupplier {
 
 /**
- * Retuns the {@code MutableContextData}.
+ * Returns the {@code MutableContextData}. Note that the returned context 
data may not be mutable; it may have been
+ * {@linkplain MutableContextData#freeze() frozen}, making the data 
structure read-only.
+ *
  * @return the {@code MutableContextData}
  */
 MutableContextData getMutableContextData();



[1/8] logging-log4j2 git commit: LOG4J2-1010 fix performance issue where new context map object created for each call when empty

2016-09-21 Thread rpopma
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 215d934af -> 16e7ef70c


LOG4J2-1010 fix performance issue where new context map object created for each 
call when empty


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

Branch: refs/heads/master
Commit: 4e4d133cac306a6f0c0b6b9923ecba9de18a2450
Parents: c8ee4b3
Author: rpopma 
Authored: Thu Sep 22 10:51:18 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 10:51:18 2016 +0900

--
 .../CopyOnWriteSortedArrayThreadContextMap.java| 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4e4d133c/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
--
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
index a8ced14..71afbef 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java
@@ -36,6 +36,12 @@ class CopyOnWriteSortedArrayThreadContextMap implements 
ThreadContextMap, Thread
 MutableContextDataSupplier {
 
 /**
+ * Property name ({@value} ) for selecting {@code InheritableThreadLocal} 
(value "true") or plain
+ * {@code ThreadLocal} (value is not "true") in the implementation.
+ */
+public static final String INHERITABLE_MAP = 
"isThreadContextMapInheritable";
+
+/**
  * The default initial capacity.
  */
 protected static final int DEFAULT_INITIAL_CAPACITY = 16;
@@ -45,11 +51,10 @@ class CopyOnWriteSortedArrayThreadContextMap implements 
ThreadContextMap, Thread
  */
 protected static final String PROPERTY_NAME_INITIAL_CAPACITY = 
"log4j2.ThreadContext.initial.capacity";
 
-/**
- * Property name ({@value} ) for selecting {@code InheritableThreadLocal} 
(value "true") or plain
- * {@code ThreadLocal} (value is not "true") in the implementation.
- */
-public static final String INHERITABLE_MAP = 
"isThreadContextMapInheritable";
+private static final MutableContextData EMPTY_CONTEXT_DATA = new 
ArrayContextData();
+static {
+EMPTY_CONTEXT_DATA.freeze();
+}
 
 private final ThreadLocal localMap;
 
@@ -162,7 +167,7 @@ class CopyOnWriteSortedArrayThreadContextMap implements 
ThreadContextMap, Thread
 @Override
 public MutableContextData getMutableContextData() {
 final MutableContextData map = localMap.get();
-return map == null ? createMutableContextData() : map;
+return map == null ? EMPTY_CONTEXT_DATA : map;
 }
 
 @Override



[3/8] logging-log4j2 git commit: LOG4J2-1447 declare public fields before protected fields

2016-09-21 Thread rpopma
LOG4J2-1447 declare public fields before protected fields


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

Branch: refs/heads/master
Commit: fc68248087699222fcb601160159040c8312b671
Parents: ca9d5e0
Author: rpopma 
Authored: Thu Sep 22 10:57:28 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 10:57:28 2016 +0900

--
 .../spi/GarbageFreeSortedArrayThreadContextMap.java | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fc682480/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
--
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
index face4c7..4709004 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java
@@ -36,6 +36,12 @@ class GarbageFreeSortedArrayThreadContextMap implements 
ThreadContextMap, Thread
 MutableContextDataSupplier {
 
 /**
+ * Property name ({@value} ) for selecting {@code InheritableThreadLocal} 
(value "true") or plain
+ * {@code ThreadLocal} (value is not "true") in the implementation.
+ */
+public static final String INHERITABLE_MAP = 
"isThreadContextMapInheritable";
+
+/**
  * The default initial capacity.
  */
 protected static final int DEFAULT_INITIAL_CAPACITY = 16;
@@ -45,12 +51,6 @@ class GarbageFreeSortedArrayThreadContextMap implements 
ThreadContextMap, Thread
  */
 protected static final String PROPERTY_NAME_INITIAL_CAPACITY = 
"log4j2.ThreadContext.initial.capacity";
 
-/**
- * Property name ({@value} ) for selecting {@code InheritableThreadLocal} 
(value "true") or plain
- * {@code ThreadLocal} (value is not "true") in the implementation.
- */
-public static final String INHERITABLE_MAP = 
"isThreadContextMapInheritable";
-
 protected final ThreadLocal localMap;
 
 public GarbageFreeSortedArrayThreadContextMap() {



[7/8] logging-log4j2 git commit: LOG4J2-1010 enhance benchmark to test with empty map

2016-09-21 Thread rpopma
LOG4J2-1010 enhance benchmark to test with empty map


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

Branch: refs/heads/master
Commit: 3ed968ed33a2d869af0bb31c60d023620934757f
Parents: 0461989
Author: rpopma 
Authored: Thu Sep 22 11:04:01 2016 +0900
Committer: rpopma 
Committed: Thu Sep 22 11:04:01 2016 +0900

--
 .../logging/log4j/perf/jmh/MDCFilterBenchmark.java| 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3ed968ed/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/MDCFilterBenchmark.java
--
diff --git 
a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/MDCFilterBenchmark.java
 
b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/MDCFilterBenchmark.java
index 9b5c5cf..d3974a1 100644
--- 
a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/MDCFilterBenchmark.java
+++ 
b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/MDCFilterBenchmark.java
@@ -21,6 +21,7 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.ThreadContext;
 import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Param;
 import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
@@ -45,12 +46,19 @@ public class MDCFilterBenchmark {
 Logger log4jLogger;
 org.slf4j.Logger slf4jLogger;
 
+@Param({"0", "4"})
+public int size;
+
+static int staticSize;
+
 @State(Scope.Thread)
 public static class ThreadContextState {
 // Thread scope: initialize MDC/ThreadContext here to ensure each 
thread has some value set
 public ThreadContextState() {
-ThreadContext.put("user", "Apache");
-MDC.put("user", "Apache");
+for (int i = 0; i < staticSize; i++) {
+ThreadContext.put("user" + i, "Apache");
+MDC.put("user" + i, "Apache");
+}
 }
 
 public String message() {
@@ -65,6 +73,8 @@ public class MDCFilterBenchmark {
 
 log4jLogger = LogManager.getLogger(MDCFilterBenchmark.class);
 slf4jLogger = LoggerFactory.getLogger(MDCFilterBenchmark.class);
+
+staticSize = size;
 }
 
 @TearDown



logging-log4j2 git commit: Java req doc tweak.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master fe7a0a805 -> 215d934af


Java req doc tweak.

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

Branch: refs/heads/master
Commit: 215d934af856234cab6d5c472ba635d98303fd09
Parents: fe7a0a8
Author: Gary Gregory 
Authored: Wed Sep 21 18:03:57 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 18:03:57 2016 -0700

--
 src/site/xdoc/runtime-dependencies.xml | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/215d934a/src/site/xdoc/runtime-dependencies.xml
--
diff --git a/src/site/xdoc/runtime-dependencies.xml 
b/src/site/xdoc/runtime-dependencies.xml
index 29c2015..a60aedb 100644
--- a/src/site/xdoc/runtime-dependencies.xml
+++ b/src/site/xdoc/runtime-dependencies.xml
@@ -29,7 +29,10 @@
 dependencies.
   
   
-As of version 2.4, Log4J requires Java 7. Versions 2.3 and earlier 
require Java 6.
+As of version 2.4, Log4J requires Java 7.
+  
+  
+Log4j version 2.3 and older require Java 6.
   
 
   



logging-log4j2 git commit: [LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master a2af6ed49 -> 906abebb3


[LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender.

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

Branch: refs/heads/master
Commit: 906abebb3814cc82b02d12daa7836656a9d6c71e
Parents: a2af6ed
Author: Gary Gregory 
Authored: Wed Sep 21 20:38:29 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 20:38:29 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java | 531 ++-
 .../config/Log4j1ConfigurationFactoryTest.java  |  34 +-
 ...4j-RollingFileAppender-with-props.properties |  27 +
 .../log4j-RollingFileAppender.properties|  22 +
 4 files changed, 360 insertions(+), 254 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/906abebb/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 adc512c..0d5be53 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
@@ -42,281 +42,306 @@ import org.apache.logging.log4j.status.StatusLogger;
  */
 public class Log4j1ConfigurationParser {
 
-private final Properties properties = new Properties();
-private final ConfigurationBuilder builder = 
ConfigurationBuilderFactory.newConfigurationBuilder();
+   private final Properties properties = new Properties();
+   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
- */
-public ConfigurationBuilder 
buildConfigurationBuilder(final InputStream input) throws IOException {
-properties.load(input);
-final String rootCategoryValue = getLog4jValue("rootCategory");
-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");
-}
-builder.setConfigurationName("Log4j1");
-// DEBUG
-final String debugValue = getLog4jValue("debug");
-if (Boolean.valueOf(debugValue)) {
-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;
-// Appenders
-final Map classNameToProperty = 
buildClassToPropertyPrefixMap(sortedAppenderNames);
-for (final Map.Entry entry : 
classNameToProperty.entrySet()) {
-final String appenderName = entry.getKey();
-final String appenderClass = entry.getValue();
-buildAppender(appenderName, appenderClass);
-}
-// Loggers
-buildLoggers("log4j.category.");
-buildLoggers("log4j.logger.");
-return builder;
-}
+   /**
+* 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
+*/
+   public ConfigurationBuilder 
buildConfigurationBuilder(final InputStream input)
+   throws IOException {
+   

logging-log4j2 git commit: Handy Console-only configuration file for ah-hoc tests.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master c8ee4b3b6 -> 8729b28d0


Handy Console-only configuration file for ah-hoc tests.

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

Branch: refs/heads/master
Commit: 8729b28d01d4335566f390bd76abc8728745
Parents: c8ee4b3
Author: Gary Gregory 
Authored: Wed Sep 21 16:17:39 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 16:17:39 2016 -0700

--
 log4j-core/src/test/resources/log4j-console.xml | 29 
 1 file changed, 29 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8729b28d/log4j-core/src/test/resources/log4j-console.xml
--
diff --git a/log4j-core/src/test/resources/log4j-console.xml 
b/log4j-core/src/test/resources/log4j-console.xml
new file mode 100644
index 000..6e10b8a
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-console.xml
@@ -0,0 +1,29 @@
+
+
+
+  
+
+  
+
+  
+  
+
+  
+
+  
+
\ No newline at end of file



logging-log4j2 git commit: [LOG4J2-1523] Log4j 1 appenders. NullAppender.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 16e7ef70c -> a2af6ed49


[LOG4J2-1523] Log4j 1 appenders. NullAppender.

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

Branch: refs/heads/master
Commit: a2af6ed49267c44254891f1c7826ea610d5b5294
Parents: 16e7ef7
Author: Gary Gregory 
Authored: Wed Sep 21 19:27:42 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 19:27:42 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java |  10 +-
 .../config/Log4j1ConfigurationFactoryTest.java  | 174 +++
 .../config-1.2/log4j-NullAppender.properties|   9 +
 .../log4j/core/appender/NullAppender.java   |  29 
 4 files changed, 144 insertions(+), 78 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a2af6ed4/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 a8c3977..adc512c 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
@@ -117,12 +117,15 @@ public class Log4j1ConfigurationParser {
 case "org.apache.log4j.FileAppender":
 buildFileAppender(appenderName);
 break;
+case "org.apache.log4j.varia.NullAppender":
+buildNullAppender(appenderName);
+break;
 default:
 reportWarning("Unknown appender class: " + appenderClass + "; 
ignoring appender: " + appenderName);
 }
 }
 
-private void buildConsoleAppender(final String appenderName) {
+   private void buildConsoleAppender(final String appenderName) {
 final AppenderComponentBuilder appenderBuilder = 
builder.newAppender(appenderName, "Console");
 final String targetValue = getLog4jAppenderValue(appenderName, 
"Target", "System.out");
 if (targetValue != null) {
@@ -185,6 +188,11 @@ public class Log4j1ConfigurationParser {
 }
 }
 
+private void buildNullAppender(String appenderName) {
+final AppenderComponentBuilder appenderBuilder = 
builder.newAppender(appenderName, "Null");
+builder.add(appenderBuilder);
+   }
+
 private void buildAppenderLayout(final String name, final 
AppenderComponentBuilder appenderBuilder) {
 final String layoutClass = getLog4jAppenderValue(name, "layout", null);
 if (layoutClass != null) {

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a2af6ed4/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 ea55dd9..842bf6b 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
@@ -16,97 +16,117 @@
  */
 package org.apache.log4j.config;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URISyntaxException;
 import java.net.URL;
 
 import org.apache.log4j.layout.Log4j1XmlLayout;
 import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.appender.ConsoleAppender.Target;
 import org.apache.logging.log4j.core.appender.FileAppender;
+import org.apache.logging.log4j.core.appender.NullAppender;
 import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.layout.HtmlLayout;
 import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.apache.logging.log4j.status.StatusLogger;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 public class Log4j1ConfigurationFactoryTest {
 
-private Layout testConsole(final String configResource) throws 
Exception {
-final URL 

logging-log4j2 git commit: [LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender with property substitutions.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 518ff5645 -> 71cab8985


[LOG4J2-1523] Log4j 1 appenders. Classic RollingFileAppender with
property substitutions.

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

Branch: refs/heads/master
Commit: 71cab89858ef319b35014dbe59de3e254e8cf205
Parents: 518ff56
Author: Gary Gregory 
Authored: Wed Sep 21 21:05:38 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 21:05:38 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationParser.java  |  9 ++---
 .../config/Log4j1ConfigurationFactoryTest.java   |  1 -
 .../log4j/core/lookup/StrSubstitutor.java| 19 +++
 3 files changed, 25 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/71cab898/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 f529049..579e600 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
@@ -33,6 +33,7 @@ import 
org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFact
 import org.apache.logging.log4j.core.config.builder.api.LayoutComponentBuilder;
 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;
 
 /**
@@ -43,6 +44,8 @@ import org.apache.logging.log4j.status.StatusLogger;
 public class Log4j1ConfigurationParser {
 
private final Properties properties = new Properties();
+   private StrSubstitutor strSubstitutor;
+   
private final ConfigurationBuilder builder = 
ConfigurationBuilderFactory
.newConfigurationBuilder();
 
@@ -61,6 +64,7 @@ public class Log4j1ConfigurationParser {
public ConfigurationBuilder 
buildConfigurationBuilder(final InputStream input)
throws IOException {
properties.load(input);
+   strSubstitutor = new StrSubstitutor(properties);
final String rootCategoryValue = getLog4jValue("rootCategory");
final String rootLoggerValue = getLog4jValue("rootLogger");
if (rootCategoryValue == null && rootLoggerValue == null) {
@@ -324,7 +328,6 @@ public class Log4j1ConfigurationParser {
}
}
}
-
}
 
private String getLog4jAppenderValue(final String appenderName, final 
String attributeName) {
@@ -332,11 +335,11 @@ public class Log4j1ConfigurationParser {
}
 
private String getProperty(final String key) {
-   return properties.getProperty(key);
+   return strSubstitutor.replace(properties.getProperty(key));
}
 
private String getProperty(final String key, String defaultValue) {
-   return properties.getProperty(key, defaultValue);
+   return strSubstitutor.replace(properties.getProperty(key, 
defaultValue));
}
 
private String getLog4jAppenderValue(final String appenderName, final 
String attributeName,

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/71cab898/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 d5ee84f..8c6260d 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
@@ -140,7 +140,6 @@ public class Log4j1ConfigurationFactoryTest {
}
 
@Test
-   @Ignore("TODO")
public void testRollingFileAppenderWithProperties() throws Exception {

testRollingFileAppender("config-1.2/log4j-RollingFileAppender-with-props.properties");
}


logging-log4j2 git commit: Add TODO

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 906abebb3 -> 1815dab40


Add TODO

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

Branch: refs/heads/master
Commit: 1815dab40ddd547380b201f4acd11b2f7d138661
Parents: 906abeb
Author: Gary Gregory 
Authored: Wed Sep 21 20:42:40 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 20:42:40 2016 -0700

--
 .../log4j/config/Log4j1ConfigurationFactoryTest.java | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1815dab4/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 81be695..d5ee84f 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
@@ -42,7 +42,7 @@ import org.apache.logging.log4j.core.config.Configuration;
 import org.apache.logging.log4j.core.config.LoggerConfig;
 import org.apache.logging.log4j.core.layout.HtmlLayout;
 import org.apache.logging.log4j.core.layout.PatternLayout;
-import org.apache.logging.log4j.status.StatusLogger;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class Log4j1ConfigurationFactoryTest {
@@ -136,8 +136,17 @@ public class Log4j1ConfigurationFactoryTest {
 
@Test
public void testRollingFileAppender() throws Exception {
-   StatusLogger.getLogger().setLevel(Level.TRACE);
-   final Configuration configuration = 
configure("config-1.2/log4j-RollingFileAppender.properties");
+   
testRollingFileAppender("config-1.2/log4j-RollingFileAppender.properties");
+   }
+
+   @Test
+   @Ignore("TODO")
+   public void testRollingFileAppenderWithProperties() throws Exception {
+   
testRollingFileAppender("config-1.2/log4j-RollingFileAppender-with-props.properties");
+   }
+
+   private void testRollingFileAppender(final String configResource) 
throws URISyntaxException {
+   final Configuration configuration = configure(configResource);
final Appender appender = configuration.getAppender("RFA");
assertNotNull(appender);
assertEquals("RFA", appender.getName());



logging-log4j2 git commit: [LOG4J2-1604] Log4j2 TcpSocketServer in background.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 8729b28d0 -> ee87a184c


[LOG4J2-1604] Log4j2 TcpSocketServer in background.

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

Branch: refs/heads/master
Commit: ee87a184c7ccbfe03234782ebd6cc76c954a4a3c
Parents: 8729b28
Author: Gary Gregory 
Authored: Wed Sep 21 16:19:43 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 16:19:43 2016 -0700

--
 log4j-core/pom.xml  |   6 +
 .../core/net/server/AbstractSocketServer.java   |  93 +-
 .../log4j/core/net/server/TcpSocketServer.java  | 180 ---
 .../log4j/core/net/server/UdpSocketServer.java  |  83 -
 .../log4j/core/util/InetAddressConverter.java   |  19 ++
 pom.xml |   5 +
 src/changes/changes.xml |   3 +
 7 files changed, 277 insertions(+), 112 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ee87a184/log4j-core/pom.xml
--
diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml
index 6142dad..120404b 100644
--- a/log4j-core/pom.xml
+++ b/log4j-core/pom.xml
@@ -144,6 +144,12 @@
   commons-csv
   true
 
+
+
+  com.beust
+  jcommander
+  true
+
 
 
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ee87a184/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 7350e6d..8e24c25 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
@@ -21,6 +21,7 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -34,18 +35,85 @@ 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.InetAddressConverter;
 import org.apache.logging.log4j.core.util.Log4jThread;
 import org.apache.logging.log4j.util.Strings;
 
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.validators.PositiveInteger;
+
 /**
  * Abstract socket server for TCP and UDP implementations.
  * 
- * @param  The kind of input stream read
+ * @param 
+ *The kind of input stream read
  * 
- * TODO Make a LifeCycle
+ *TODO Make a LifeCycle
  */
 public abstract class AbstractSocketServer extends 
LogEventListener implements Runnable {
 
+protected static class CommandLineArguments {
+
+@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;
+
+@Parameter(names = { "--port",
+"-p" }, validateWith = PositiveInteger.class, description = 
"Server socket port.")
+private int port;
+
+@Parameter(names = { "--localbindaddress",
+"-a" }, converter = InetAddressConverter.class, description = 
"Server socket local bind address.")
+private InetAddress localBindAddress;
+
+String getConfigLocation() {
+return configLocation;
+}
+
+int getPort() {
+return port;
+}
+
+boolean isHelp() {
+return help;
+}
+
+protected boolean isInteractive() {
+return interactive;
+}
+
+void setConfigLocation(final String configLocation) {
+this.configLocation = configLocation;
+}
+
+void 

logging-log4j2 git commit: Better error messages.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 0052710d5 -> 19ca21f3c


Better error messages.

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

Branch: refs/heads/master
Commit: 19ca21f3c398e0ee84f110151bab3b51e5ab9a54
Parents: 0052710
Author: Gary Gregory 
Authored: Wed Sep 21 00:30:55 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 00:30:55 2016 -0700

--
 .../apache/logging/log4j/core/net/server/TcpSocketServer.java| 4 ++--
 .../apache/logging/log4j/core/net/server/UdpSocketServer.java| 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/19ca21f3/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
index aacdfb8..befa47d 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
@@ -181,13 +181,13 @@ public class TcpSocketServer 
extends AbstractSocketServer
  */
 public static void main(final String[] args) throws Exception {
 if (args.length < 1 || args.length > 2) {
-System.err.println("Incorrect number of arguments");
+System.err.println("Incorrect number of arguments: " + 
args.length);
 printUsage();
 return;
 }
 final int port = Integer.parseInt(args[0]);
 if (port <= 0 || port >= MAX_PORT) {
-System.err.println("Invalid port number");
+System.err.println("Invalid port number: " + port);
 printUsage();
 return;
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/19ca21f3/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/UdpSocketServer.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/UdpSocketServer.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/UdpSocketServer.java
index 7cf386c..ce05b14 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/UdpSocketServer.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/UdpSocketServer.java
@@ -106,13 +106,13 @@ public class UdpSocketServer 
extends AbstractSocketServer
  */
 public static void main(final String[] args) throws Exception {
 if (args.length < 1 || args.length > 2) {
-System.err.println("Incorrect number of arguments");
+System.err.println("Incorrect number of arguments: " + 
args.length);
 printUsage();
 return;
 }
 final int port = Integer.parseInt(args[0]);
 if (port <= 0 || port >= MAX_PORT) {
-System.err.println("Invalid port number");
+System.err.println("Invalid port number:" + port);
 printUsage();
 return;
 }



[1/2] logging-log4j2 git commit: Better error messages.

2016-09-21 Thread ggregory
Repository: logging-log4j2
Updated Branches:
  refs/heads/master 19ca21f3c -> 935e72a97


Better error messages.

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

Branch: refs/heads/master
Commit: cc86d6aa67dc82efd5750f5b2164b91ed865c0cd
Parents: 19ca21f
Author: Gary Gregory 
Authored: Wed Sep 21 00:34:29 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 00:34:29 2016 -0700

--
 .../org/apache/logging/log4j/core/net/server/TcpSocketServer.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cc86d6aa/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
--
diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
index befa47d..6dfce72 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java
@@ -244,7 +244,7 @@ public class TcpSocketServer extends 
AbstractSocketServer
 logger.traceExit(entry);
 return;
 }
-logger.error("Exception encountered on accept. Ignoring. Stack 
Trace :", e);
+logger.error("Exception encountered on accept. Ignoring. Stack 
trace :", e);
 }
 }
 for (final Map.Entry handlerEntry : 
handlers.entrySet()) {



[2/2] logging-log4j2 git commit: [LOG4J2-1605]

2016-09-21 Thread ggregory
[LOG4J2-1605] 

Improve error messages for TcpSocketServer and UdpSocketServer.

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

Branch: refs/heads/master
Commit: 935e72a9795ed99d20e977608bc0627d14c0cb57
Parents: cc86d6a
Author: Gary Gregory 
Authored: Wed Sep 21 00:38:47 2016 -0700
Committer: Gary Gregory 
Committed: Wed Sep 21 00:38:47 2016 -0700

--
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/935e72a9/src/changes/changes.xml
--
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ee7844d..4438f1e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -264,6 +264,9 @@
   
 Custom Log4j threads now extend Log4jThread.
   
+  
+Improve error messages for TcpSocketServer and UdpSocketServer.
+  
   
 Updated Jackson from 2.7.5 to 2.8.0.