You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/10/04 18:28:03 UTC

[01/15] git commit: Javadoc.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master a870e1abb -> 408d0a9ab


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

Branch: refs/heads/master
Commit: 9e55a20439dd975071511aa40e21d70ab6a3b0b9
Parents: af2cf40
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 01:16:58 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9e55a204/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
index de2a573..b7be917 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/LoggerContext.java
@@ -24,7 +24,7 @@ import org.apache.logging.log4j.message.MessageFactory;
 public interface LoggerContext {
 
     /**
-     * An anchor for some other context, such as a ServletContext.
+     * An anchor for some other context, such as a ClassLoader or ServletContext.
      * @return The external context.
      */
     Object getExternalContext();


[08/15] git commit: Specify logback scope in log4j-perf.

Posted by ma...@apache.org.
Specify logback scope in log4j-perf.


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

Branch: refs/heads/master
Commit: 85f01ff1fd58a8f844079122a814a205b1d045db
Parents: 9e55a20
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:00:43 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:00:43 2014 -0500

----------------------------------------------------------------------
 log4j-perf/pom.xml | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/85f01ff1/log4j-perf/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-perf/pom.xml b/log4j-perf/pom.xml
index 553410a..8e270ec 100644
--- a/log4j-perf/pom.xml
+++ b/log4j-perf/pom.xml
@@ -75,10 +75,12 @@
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-core</artifactId>
+      <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
+      <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>log4j</groupId>


[06/15] git commit: Fix javadoc warnings.

Posted by ma...@apache.org.
Fix javadoc warnings.


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

Branch: refs/heads/master
Commit: af2cf40f89d3339b5c88d105b4b90525c0a706bd
Parents: 1ad3db8
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 01:02:30 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

----------------------------------------------------------------------
 log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java      | 8 ++++----
 log4j-1.2-api/src/main/java/org/apache/log4j/Priority.java | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/af2cf40f/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java b/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
index afd3e13..1500630 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
@@ -91,8 +91,8 @@ public final class NDC {
 
 
     /**
-     * <font color="#FF4040"><b>Never use this method directly.</b></font>
-     * 
+     * <strong style="color:#FF4040">Never use this method directly.</strong>
+     *
      * @return The string value of the specified key.
      */
     public static String get() {
@@ -187,9 +187,9 @@ public final class NDC {
      * <pre>
      * void foo() {
      * &nbsp;  int depth = NDC.getDepth();
-     * 
+     *
      * &nbsp;  ... complex sequence of calls
-     * 
+     *
      * &nbsp;  NDC.setMaxDepth(depth);
      * }
      * </pre>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/af2cf40f/log4j-1.2-api/src/main/java/org/apache/log4j/Priority.java
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/Priority.java b/log4j-1.2-api/src/main/java/org/apache/log4j/Priority.java
index 10759d1..8f6eee9 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/Priority.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/Priority.java
@@ -17,8 +17,8 @@
 package org.apache.log4j;
 
 /**
- * <font color="#AA4444">Refrain from using this class directly, use
- * the {@link Level} class instead</font>.
+ * <em style="color:#A44">Refrain from using this class directly, use
+ * the {@link Level} class instead.</em>
  */
 public class Priority {
 


[07/15] git commit: Remove unused custom javadoc tags.

Posted by ma...@apache.org.
Remove unused custom javadoc tags.


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

Branch: refs/heads/master
Commit: 1ad3db85b0ef9a9d414c79da0e8bf44014600801
Parents: 29d96f6
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 01:02:07 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

----------------------------------------------------------------------
 log4j-1.2-api/pom.xml | 17 -----------------
 1 file changed, 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1ad3db85/log4j-1.2-api/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-1.2-api/pom.xml b/log4j-1.2-api/pom.xml
index cafdb35..e531794 100644
--- a/log4j-1.2-api/pom.xml
+++ b/log4j-1.2-api/pom.xml
@@ -147,23 +147,6 @@
                project -->
           <detectOfflineLinks>false</detectOfflineLinks>
           <linksource>true</linksource>
-          <tags>
-            <tag>
-              <name>issue</name>
-              <placement>a</placement>
-              <head>JIRA issue:</head>
-            </tag>
-            <tag>
-              <name>doubt</name>
-              <placement>a</placement>
-              <head>Troublesome:</head>
-            </tag>
-            <tag>
-              <name>compare</name>
-              <placement>a</placement>
-              <head>Compare with:</head>
-            </tag>
-          </tags>
         </configuration>
         <reportSets>
           <reportSet>


[11/15] git commit: Move ReflectionUtil feature from log4j-slf4j-impl.

Posted by ma...@apache.org.
Move ReflectionUtil feature from log4j-slf4j-impl.


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

Branch: refs/heads/master
Commit: c91070abf0c103e0254dbae12dea3e2defce9625
Parents: 599c1f0
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:41:17 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:41:17 2014 -0500

----------------------------------------------------------------------
 .../apache/logging/log4j/util/ReflectionUtil.java    | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c91070ab/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
index 89e7a20..ad707c7 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
@@ -185,6 +185,11 @@ public final class ReflectionUtil {
 
     // migrated from ClassLoaderContextSelector
     public static Class<?> getCallerClass(final String fqcn) {
+        return getCallerClass(fqcn, "");
+    }
+
+    // migrated from Log4jLoggerFactory
+    public static Class<?> getCallerClass(final String fqcn, final String pkg) {
         if (supportsFastReflection()) {
             boolean next = false;
             Class<?> clazz;
@@ -193,14 +198,14 @@ public final class ReflectionUtil {
                     next = true;
                     continue;
                 }
-                if (next) {
+                if (next && clazz.getName().startsWith(pkg)) {
                     return clazz;
                 }
             }
             return null;
         }
         if (SECURITY_MANAGER != null) {
-            return SECURITY_MANAGER.getCallerClass(fqcn);
+            return SECURITY_MANAGER.getCallerClass(fqcn, pkg);
         }
         boolean next = false;
         final StackTraceElement[] elements = new Throwable().getStackTrace();
@@ -211,7 +216,7 @@ public final class ReflectionUtil {
                     next = true;
                     continue;
                 }
-                if (next) {
+                if (next && className.startsWith(pkg)) {
                     return LoaderUtil.loadClass(className);
                 }
             }
@@ -252,7 +257,7 @@ public final class ReflectionUtil {
             return super.getClassContext();
         }
 
-        protected Class<?> getCallerClass(final String fqcn) {
+        protected Class<?> getCallerClass(final String fqcn, final String pkg) {
             final Class<?>[] classes = getClassContext();
             boolean next = false;
             for (final Class<?> clazz : classes) {
@@ -260,7 +265,7 @@ public final class ReflectionUtil {
                     next = true;
                     continue;
                 }
-                if (next) {
+                if (next && clazz.getName().startsWith(pkg)) {
                     return clazz;
                 }
             }


[14/15] git commit: Update tests to use ILC.

Posted by ma...@apache.org.
Update tests to use ILC.


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

Branch: refs/heads/master
Commit: 260a4a0180d684c704263bf9750f82264ecf4d5c
Parents: ee9a055
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:54:23 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:56:03 2014 -0500

----------------------------------------------------------------------
 .../org/apache/logging/slf4j/OptionalTest.java  | 43 ++++----------------
 .../org/apache/logging/slf4j/SerializeTest.java | 25 ++----------
 2 files changed, 13 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/260a4a01/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java
----------------------------------------------------------------------
diff --git a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java
index def24f4..587c032 100644
--- a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java
+++ b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/OptionalTest.java
@@ -17,18 +17,12 @@
 package org.apache.logging.slf4j;
 
 import java.util.List;
-import java.util.Map;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.core.Appender;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
 import org.apache.logging.log4j.core.util.Constants;
-import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.junit.InitialLoggerContext;
 import org.apache.logging.log4j.test.appender.ListAppender;
-import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.BeforeClass;
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,22 +38,9 @@ import static org.junit.Assert.*;
 public class OptionalTest {
 
     private static final String CONFIG = "log4j-test1.xml";
-    private static LoggerContext ctx;
 
-    @BeforeClass
-    public static void setupClass() {
-        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
-        ctx = (LoggerContext) LogManager.getContext(false);
-        ctx.reconfigure();
-        ctx.getConfiguration();
-    }
-
-    @AfterClass
-    public static void cleanupClass() {
-        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
-        ctx.reconfigure();
-        StatusLogger.getLogger().reset();
-    }
+    @ClassRule
+    public static final InitialLoggerContext CTX = new InitialLoggerContext(CONFIG);
 
     Logger logger = LoggerFactory.getLogger("EventLogger");
     Marker marker = MarkerFactory.getMarker("EVENT");
@@ -72,23 +53,17 @@ public class OptionalTest {
     }
 
     private void verify(final String name, final String expected) {
-        //LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
-        final Appender listApp = ctx.getConfiguration().getAppender(name);
-        assertNotNull("Missing Appender", listApp);
-        assertTrue("Not a ListAppender", listApp instanceof ListAppender);
-        final List<String> events = ((ListAppender) listApp).getMessages();
+        final ListAppender listApp = CTX.getListAppender(name);
+        final List<String> events = listApp.getMessages();
         assertTrue("Incorrect number of messages. Expected 1 Actual " + events.size(), events.size()== 1);
         final String actual = events.get(0);
         assertEquals("Incorrect message. Expected " + expected + ". Actual " + actual, expected, actual);
-        ((ListAppender) listApp).clear();
+        listApp.clear();
     }
 
     @Before
     public void cleanup() {
-        final Map<String, Appender> map = ctx.getConfiguration().getAppenders();
-        final Appender listApp = map.get("List");
-        ((ListAppender) listApp).clear();
-        final Appender eventApp = map.get("EventLogger");
-        ((ListAppender) eventApp).clear();
+        CTX.getListAppender("List").clear();
+        CTX.getListAppender("EventLogger").clear();
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/260a4a01/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java
----------------------------------------------------------------------
diff --git a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java
index 0ecc493..f44d8ac 100644
--- a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java
+++ b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/SerializeTest.java
@@ -21,12 +21,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.ConfigurationFactory;
-import org.apache.logging.log4j.status.StatusLogger;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.logging.log4j.junit.InitialLoggerContext;
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,22 +38,9 @@ public class SerializeTest {
 
 
     private static final String CONFIG = "log4j-test1.xml";
-    private static LoggerContext ctx;
 
-    @BeforeClass
-    public static void setupClass() {
-        System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG);
-        ctx = (LoggerContext) LogManager.getContext(false);
-        ctx.reconfigure();
-        ctx.getConfiguration();
-    }
-
-    @AfterClass
-    public static void cleanupClass() {
-        System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
-        ctx.reconfigure();
-        StatusLogger.getLogger().reset();
-    }
+    @ClassRule
+    public static final InitialLoggerContext CTX = new InitialLoggerContext(CONFIG);
 
     Logger logger = LoggerFactory.getLogger("LoggerTest");
     XLogger xlogger = XLoggerFactory.getXLogger("LoggerTest");


[12/15] git commit: Speed up log4j-slf4j-impl LoggerContext lookup.

Posted by ma...@apache.org.
Speed up log4j-slf4j-impl LoggerContext lookup.


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

Branch: refs/heads/master
Commit: 1ad7be8ad5c6abec45d91657dba5a6166c0fe141
Parents: c91070a
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:48:10 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:48:10 2014 -0500

----------------------------------------------------------------------
 .../logging/slf4j/Log4jLoggerFactory.java       | 22 ++------------------
 1 file changed, 2 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1ad7be8a/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jLoggerFactory.java
----------------------------------------------------------------------
diff --git a/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jLoggerFactory.java b/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jLoggerFactory.java
index 3c82b87..a5ff7af 100644
--- a/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jLoggerFactory.java
+++ b/log4j-slf4j-impl/src/main/java/org/apache/logging/slf4j/Log4jLoggerFactory.java
@@ -20,6 +20,7 @@ import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.spi.AbstractLoggerAdapter;
 import org.apache.logging.log4j.spi.ExtendedLogger;
 import org.apache.logging.log4j.spi.LoggerContext;
+import org.apache.logging.log4j.util.ReflectionUtil;
 import org.slf4j.ILoggerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -40,26 +41,7 @@ public class Log4jLoggerFactory extends AbstractLoggerAdapter<Logger> implements
 
     @Override
     protected LoggerContext getContext() {
-        final Throwable t = new Throwable();
-        boolean next = false;
-        boolean pkg = false;
-        String fqcn = LoggerFactory.class.getName();
-        // TODO: update with LOG4J2-809
-        for (final StackTraceElement element : t.getStackTrace()) {
-            if (FQCN.equals(element.getClassName())) {
-                next = true;
-                continue;
-            }
-            if (next && element.getClassName().startsWith(PACKAGE)) {
-                fqcn = element.getClassName();
-                pkg = true;
-                continue;
-            }
-            if (pkg) {
-                break;
-            }
-        }
-        return PrivateManager.getContext(fqcn);
+        return PrivateManager.getContext(ReflectionUtil.getCallerClass(FQCN, PACKAGE).getName());
     }
 
     /**


[03/15] git commit: Update for 2.1 release.

Posted by ma...@apache.org.
Update for 2.1 release.


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

Branch: refs/heads/master
Commit: e981621f77c8ee8b59ad8a76dabeee4c9b6c768d
Parents: d83e1dc
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 00:32:56 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

----------------------------------------------------------------------
 src/changes/announcement.vm | 116 ++++++++++++++++++++-------------------
 1 file changed, 59 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e981621f/src/changes/announcement.vm
----------------------------------------------------------------------
diff --git a/src/changes/announcement.vm b/src/changes/announcement.vm
index aa7296d..0894330 100644
--- a/src/changes/announcement.vm
+++ b/src/changes/announcement.vm
@@ -26,7 +26,9 @@ Log4j that provides significant improvements over its predecessor, Log4j 1.x, an
 many of the improvements available in Logback while fixing some inherent problems in Logback's
 architecture.
 
-This is the third GA release which contains several bugfixes from the previous release.
+This is the fourth GA release which contains several bugfixes and new features. There are two
+new Maven artifacts in this release: log4j-jul and log4j-iostreams. Both components are API-based
+with optional Core features.
 
 ## Hack to improve layout: replace all pairs of spaces with a single new-line
 $release.description.replaceAll("  ", "
@@ -160,25 +162,25 @@ Changes in this version include:
 
 
 Fixed Bugs:
-o LOG4J2-773:  Site: log4j-core component pages were still using the old logo. 
+o LOG4J2-773:  Site: log4j-core component pages were still using the old logo.
 o LOG4J2-760:  Documentation improvement: link to dependency tree from log4j-core component page,
-        link to log4j-core component page from FAQ page. 
-o LOG4J2-679:  Resolved race condition that caused log file rotation to fail with error: "Unable to create directory ..." 
-o LOG4J2-726:  Prevent application from hanging when PatternLayout configuration has opening '{' but no closing '}'. 
-o LOG4J2-769:  Startup takes a long time if you have empty packages attribute. Thanks to Scott Harrington. 
+        link to log4j-core component page from FAQ page.
+o LOG4J2-679:  Resolved race condition that caused log file rotation to fail with error: "Unable to create directory ..."
+o LOG4J2-726:  Prevent application from hanging when PatternLayout configuration has opening '{' but no closing '}'.
+o LOG4J2-769:  Startup takes a long time if you have empty packages attribute. Thanks to Scott Harrington.
 o LOG4J2-763:  Improved asynchronous loggers and appenders to ensure the formatted message does not change even if
         parameters are modified by the application. (ParameterizedMessage was already safe.)
-        Improved documentation. Thanks to Stephen Connolly. 
-o LOG4J2-729:  Emit warning message to console if no configuration file found. 
-o LOG4J2-765:  Improve warning message when missing log4j-core in the classpath. 
-o LOG4J2-722:  Clarified in documentation that Commons Logging jar is required when using log4j-jcl. 
-o LOG4J2-723:  Clarified in documentation that SLF4J API jar is required when using log4j-slf4j-impl. 
-o LOG4J2-759:  Fixed various minor site/documentation issues, mostly versioning related. 
-o LOG4J2-756:  Prevent JUnit test from creating unnecessary Log4j2Plugins.dat during build. Thanks to Scott Harrington. 
+        Improved documentation. Thanks to Stephen Connolly.
+o LOG4J2-729:  Emit warning message to console if no configuration file found.
+o LOG4J2-765:  Improve warning message when missing log4j-core in the classpath.
+o LOG4J2-722:  Clarified in documentation that Commons Logging jar is required when using log4j-jcl.
+o LOG4J2-723:  Clarified in documentation that SLF4J API jar is required when using log4j-slf4j-impl.
+o LOG4J2-759:  Fixed various minor site/documentation issues, mostly versioning related.
+o LOG4J2-756:  Prevent JUnit test from creating unnecessary Log4j2Plugins.dat during build. Thanks to Scott Harrington.
 
 Changes:
-o LOG4J2-775:  Update Apache Flume to 1.5.0.1 from 1.5.0. 
-o LOG4J2-730:  Allow Log4jContextFactory subclasses to specify a custom ContextSelector. 
+o LOG4J2-775:  Update Apache Flume to 1.5.0.1 from 1.5.0.
+o LOG4J2-730:  Allow Log4jContextFactory subclasses to specify a custom ContextSelector.
 
 
 Apache Log4j 2.0.2 requires a minimum of Java 6 to build and run. Basic compatibility with
@@ -209,28 +211,28 @@ This is the first GA release, after thirteen prior releases over the last 4 year
 Changes in this version include:
 
 New features:
-o LOG4J2-725:  Added WebLoggerContextUtils class to log4j-web for helper methods useful for asynchronous servlets. 
-o LOG4J2-710:  Added documentation for Custom Levels and Custom Loggers. 
+o LOG4J2-725:  Added WebLoggerContextUtils class to log4j-web for helper methods useful for asynchronous servlets.
+o LOG4J2-710:  Added documentation for Custom Levels and Custom Loggers.
 
 Fixed Bugs:
-o LOG4J2-744:  Avoid unnecessary Clock calls when TimestampMessage is logged. Thanks to Scott Harrington. 
-o LOG4J2-704:  Improved error message if configuration file not found. 
-o LOG4J2-750:  Webapp configuration page has incorrect class name. Thanks to Mike Calmus. 
-o LOG4J2-749:  Retain the default date pattern after fixing the ISO8601 pattern. Thanks to Scott Harrington. 
-o LOG4J2-670:  DatePatternConverter ISO8601_PATTERN now conforms to ISO8601. 
-o LOG4J2-741:  Reinstate the package configuration attribute for discovering custom plugins. 
-o LOG4J2-742:  XInclude not working with relative path. Thanks to Pascal Chollet. 
-o LOG4J2-740:  Fixed typo in webapp manual regarding sample web.xml file. Thanks to Kosta Krauth. 
-o LOG4J2-738:  RollingFileManager deadlock if async action thread fails to start. Thanks to Timothy Stack. 
-o LOG4J2-736:  Fixed log4j-bom so that it won't specify a default scope on any third party dependencies. 
-o LOG4J2-735:  Fixed log4j-bom so that it won't interfere with spring-bom and others. 
-o LOG4J2-731:  Updated documentation regarding extensions to LoggerContextFactory and Log4j 2 providers. 
-o LOG4J2-373:  Fixed ClassLoader issues in loading Log4j providers in an OSGi environment. 
-o LOG4J2-719:  Correctly handle NetworkOnMainThreadException thrown on Android during Log4j2 initialization. 
-o LOG4J2-716:  Automatically disable log4j JMX when detecting we are running on Android. 
-o LOG4J2-657:  Fixed AbstractDatabaseManager to close connection on writeInternal error. Thanks to Stefan Wehner. 
-o LOG4J2-713:  Android: java.lang.VerifyError: org/apache/logging/log4j/core/util/Closer Thanks to Nelson Melina. 
-o LOG4J2-703:  Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Thanks to Nelson Melina. 
+o LOG4J2-744:  Avoid unnecessary Clock calls when TimestampMessage is logged. Thanks to Scott Harrington.
+o LOG4J2-704:  Improved error message if configuration file not found.
+o LOG4J2-750:  Webapp configuration page has incorrect class name. Thanks to Mike Calmus.
+o LOG4J2-749:  Retain the default date pattern after fixing the ISO8601 pattern. Thanks to Scott Harrington.
+o LOG4J2-670:  DatePatternConverter ISO8601_PATTERN now conforms to ISO8601.
+o LOG4J2-741:  Reinstate the package configuration attribute for discovering custom plugins.
+o LOG4J2-742:  XInclude not working with relative path. Thanks to Pascal Chollet.
+o LOG4J2-740:  Fixed typo in webapp manual regarding sample web.xml file. Thanks to Kosta Krauth.
+o LOG4J2-738:  RollingFileManager deadlock if async action thread fails to start. Thanks to Timothy Stack.
+o LOG4J2-736:  Fixed log4j-bom so that it won't specify a default scope on any third party dependencies.
+o LOG4J2-735:  Fixed log4j-bom so that it won't interfere with spring-bom and others.
+o LOG4J2-731:  Updated documentation regarding extensions to LoggerContextFactory and Log4j 2 providers.
+o LOG4J2-373:  Fixed ClassLoader issues in loading Log4j providers in an OSGi environment.
+o LOG4J2-719:  Correctly handle NetworkOnMainThreadException thrown on Android during Log4j2 initialization.
+o LOG4J2-716:  Automatically disable log4j JMX when detecting we are running on Android.
+o LOG4J2-657:  Fixed AbstractDatabaseManager to close connection on writeInternal error. Thanks to Stefan Wehner.
+o LOG4J2-713:  Android: java.lang.VerifyError: org/apache/logging/log4j/core/util/Closer Thanks to Nelson Melina.
+o LOG4J2-703:  Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Thanks to Nelson Melina.
 
 
 
@@ -263,35 +265,35 @@ Changes in this version include:
 
 New features:
 o LOG4J2-519:  Added support for generating custom logger wrappers that replace the existing log levels
-        and extended logger wrappers that add custom log levels to the existing ones. 
-o LOG4J2-696:  RegexFilter does not match multiline log messages. 
+        and extended logger wrappers that add custom log levels to the existing ones.
+o LOG4J2-696:  RegexFilter does not match multiline log messages.
 
 Fixed Bugs:
 o LOG4J2-705:  Fixed issue where Async Logger does not log thread context stack data.
-        API change: added method getImmutableStackOrNull() to ThreadContext.ContextStack interface. 
-o LOG4J2-631:  Update docs to clarify how to use formatter logger and standard logger together. 
-o LOG4J2-441:  LoggerConfigs with no Level now inherit the Level from their parent. 
-o LOG4J2-703:  Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Thanks to Nelson Melina. 
-o LOG4J2-699:  PatternLayout manual page missing documentation on header/footer. 
+        API change: added method getImmutableStackOrNull() to ThreadContext.ContextStack interface.
+o LOG4J2-631:  Update docs to clarify how to use formatter logger and standard logger together.
+o LOG4J2-441:  LoggerConfigs with no Level now inherit the Level from their parent.
+o LOG4J2-703:  Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Thanks to Nelson Melina.
+o LOG4J2-699:  PatternLayout manual page missing documentation on header/footer.
 o LOG4J2-625:  Fixed Serialization error with SocketAppender and Async Loggers.
-        (Fixed in RC2, but wasn't included in release notes.) 
+        (Fixed in RC2, but wasn't included in release notes.)
 o LOG4J2-538:  JMX GUI: fixed occasional ArrayIndexOutOfBoundsException after pressing "reconfigure with XML below".
-        (Fixed in RC2, but wasn't included in release notes.) 
-o LOG4J2-666:  AsyncLoggerContextSelector should ensure that different AsyncLoggerContext objects created by web app classloaders have unique names. 
-o LOG4J2-683:  Fix annotation processor warnings on JDK 1.7+. Thanks to Jurriaan Mous. 
-o LOG4J2-694:  Fix strange compilation error that popped up in a test class. 
-o LOG4J2-692:  Update documentation to specify only Maven 3 is supported. 
-o LOG4J2-690:  Log4j Web test dependencies should be in scope "test" in the pom. Thanks to Philip Helger. 
-o LOG4J2-682:  Special characters (tab and so on) in PatternLayout do not work. Thanks to Scott Harrington. 
-o LOG4J2-686:  Core's OptionConverter support for \b is broken (affects PatternLayout). 
-o LOG4J2-687:  Rename org.apache.logging.log4j.core.util.Closer.closeSilent() to closeSilently(). 
-o LOG4J2-688:  Make org.apache.logging.log4j.core.layout.PatternLayout immutable. 
-o LOG4J2-707:  Some exceptions are not logged when configuration problems are detected. 
+        (Fixed in RC2, but wasn't included in release notes.)
+o LOG4J2-666:  AsyncLoggerContextSelector should ensure that different AsyncLoggerContext objects created by web app classloaders have unique names.
+o LOG4J2-683:  Fix annotation processor warnings on JDK 1.7+. Thanks to Jurriaan Mous.
+o LOG4J2-694:  Fix strange compilation error that popped up in a test class.
+o LOG4J2-692:  Update documentation to specify only Maven 3 is supported.
+o LOG4J2-690:  Log4j Web test dependencies should be in scope "test" in the pom. Thanks to Philip Helger.
+o LOG4J2-682:  Special characters (tab and so on) in PatternLayout do not work. Thanks to Scott Harrington.
+o LOG4J2-686:  Core's OptionConverter support for \b is broken (affects PatternLayout).
+o LOG4J2-687:  Rename org.apache.logging.log4j.core.util.Closer.closeSilent() to closeSilently().
+o LOG4J2-688:  Make org.apache.logging.log4j.core.layout.PatternLayout immutable.
+o LOG4J2-707:  Some exceptions are not logged when configuration problems are detected.
 
 Changes:
-o LOG4J2-685:  Make org.apache.logging.log4j.core.layout.AbstractLayout immutable. 
-o LOG4J2-689:  Update Jackson to 2.4.1. 
-o LOG4J2-709:  Update Apache Commons Logging to 1.2 from 1.1.3. 
+o LOG4J2-685:  Make org.apache.logging.log4j.core.layout.AbstractLayout immutable.
+o LOG4J2-689:  Update Jackson to 2.4.1.
+o LOG4J2-709:  Update Apache Commons Logging to 1.2 from 1.1.3.
 
 
 Apache Log4j 2.0 requires a minimum of Java 6 to build and run. Basic compatibility with


[05/15] git commit: Fix configuration for maven changes plugin update.

Posted by ma...@apache.org.
Fix configuration for maven changes plugin update.


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

Branch: refs/heads/master
Commit: bc4b92c43c70187f9c1881c7a62475b931639131
Parents: e981621
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 00:36:41 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bc4b92c4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ddb0923..f50d160 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1137,7 +1137,7 @@
               <template>announcement.vm</template>
               <templateDirectory>src/changes</templateDirectory>
               <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
-              <outputDirectory>.</outputDirectory>
+              <announcementDirectory>.</announcementDirectory>
               <announcementFile>RELEASE-NOTES.txt</announcementFile>
               <issueManagementSystems>
                 <issueManagementSystem>changes.xml</issueManagementSystem>


[15/15] git commit: Refactor SerializationTestUtils into Hamcrest matchers.

Posted by ma...@apache.org.
Refactor SerializationTestUtils into Hamcrest matchers.


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

Branch: refs/heads/master
Commit: 408d0a9ab9e98f8856edccc0a1670b70abaafbdc
Parents: 260a4a0
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 11:26:46 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 11:26:46 2014 -0500

----------------------------------------------------------------------
 .../log4j/AbstractSerializationTest.java        |  7 ++-
 .../logging/log4j/SerializableMatchers.java     | 58 ++++++++++++++++++++
 .../logging/log4j/SerializationTestUtils.java   | 36 ------------
 3 files changed, 63 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/408d0a9a/log4j-api/src/test/java/org/apache/logging/log4j/AbstractSerializationTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/AbstractSerializationTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/AbstractSerializationTest.java
index 135c0b7..ea38501 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/AbstractSerializationTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/AbstractSerializationTest.java
@@ -22,6 +22,9 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
+import static org.apache.logging.log4j.SerializableMatchers.serializesRoundTrip;
+import static org.junit.Assert.assertThat;
+
 /**
  * Subclasses tests {@link Serializable} objects.
  */
@@ -37,11 +40,11 @@ public abstract class AbstractSerializationTest {
 
     @Test
     public void testSerializationRoundtripEquals() {
-        SerializationTestUtils.roundtripEquals(serializable);
+        assertThat(serializable, serializesRoundTrip(serializable));
     }
 
     @Test
     public void testSerializationRoundtripNoException() {
-        SerializationTestUtils.roundtripNoException(serializable);
+        assertThat(serializable, serializesRoundTrip());
     }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/408d0a9a/log4j-api/src/test/java/org/apache/logging/log4j/SerializableMatchers.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/SerializableMatchers.java b/log4j-api/src/test/java/org/apache/logging/log4j/SerializableMatchers.java
new file mode 100644
index 0000000..7545b96
--- /dev/null
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/SerializableMatchers.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang3.SerializationUtils;
+import org.hamcrest.FeatureMatcher;
+import org.hamcrest.Matcher;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsInstanceOf.any;
+
+/**
+ * Hamcrest Matchers for Serializable classes.
+ *
+ * @since 2.1
+ */
+public final class SerializableMatchers {
+
+    public static <T extends Serializable> Matcher<T> serializesRoundTrip(final Matcher<T> matcher) {
+        return new FeatureMatcher<T, T>(matcher, "serializes round trip", "serializes round trip") {
+            @Override
+            protected T featureValueOf(final T actual) {
+                return SerializationUtils.roundtrip(actual);
+            }
+        };
+    }
+
+    public static <T extends Serializable> Matcher<T> serializesRoundTrip(final T expected) {
+        return serializesRoundTrip(equalTo(expected));
+    }
+
+    public static <T extends Serializable> Matcher<T> serializesRoundTrip(final Class<T> clazz) {
+        return serializesRoundTrip(any(clazz));
+    }
+
+    public static Matcher<? super Serializable> serializesRoundTrip() {
+        return serializesRoundTrip(any(Serializable.class));
+    }
+
+    private SerializableMatchers() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/408d0a9a/log4j-api/src/test/java/org/apache/logging/log4j/SerializationTestUtils.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/SerializationTestUtils.java b/log4j-api/src/test/java/org/apache/logging/log4j/SerializationTestUtils.java
deleted file mode 100644
index 9009ee8..0000000
--- a/log4j-api/src/test/java/org/apache/logging/log4j/SerializationTestUtils.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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;
-
-import java.io.Serializable;
-
-import org.apache.commons.lang3.SerializationUtils;
-import org.junit.Assert;
-
-/**
- * Tests {@link Serializable} objects.
- */
-public class SerializationTestUtils {
-
-    public static void roundtripNoException(final Serializable serializable) {
-        SerializationUtils.roundtrip(serializable);
-    }
-
-    public static void roundtripEquals(final Serializable serializable) {
-        Assert.assertEquals(serializable, SerializationUtils.roundtrip(serializable));
-    }
-}


[02/15] git commit: Update release notes for 2.1

Posted by ma...@apache.org.
Update release notes for 2.1


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

Branch: refs/heads/master
Commit: 29d96f62faa497cc3c961b67d0af8347efcec096
Parents: bc4b92c
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 00:40:17 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

----------------------------------------------------------------------
 RELEASE-NOTES.txt | 241 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 227 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/29d96f62/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 77e7ace..5760493 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -1,4 +1,100 @@
 
+              Apache Log4j 2.1 RELEASE NOTES
+
+The Apache Log4j 2 team is pleased to announce the Log4j 2.1 release!
+
+Apache log4j is a well known framework for logging application behavior. Log4j 2 is an upgrade to
+Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides
+many of the improvements available in Logback while fixing some inherent problems in Logback's
+architecture.
+
+This is the fourth GA release which contains several bugfixes and new features. There are two
+new Maven artifacts in this release: log4j-jul and log4j-iostreams. Both components are API-based
+with optional Core features.
+
+GA Release 2.1
+
+Changes in this version include:
+
+New features:
+o LOG4J2-589:  Supported filtering on custom log levels in configuration. 
+o LOG4J2-856:  Documentation: add sections on the JUL Adapter, IO Streams and NoSQL Appenders to the Maven and Ivy page. 
+o LOG4J2-848:  Add a Java lookup to provide nicely formatted runtime version information. 
+o LOG4J2-809:  Move reflection utility class to API's private utility classes. 
+o LOG4J2-833:  Documentation: added Runtime Dependencies link to left nav-bar on site. 
+o LOG4J2-816:  Documentation: added section on XInclude to user manual Configuration page. 
+o LOG4J2-547:  Add the Log4j IOStreams component. 
+o LOG4J2-431:  Added Memory-Mapped File Appender. Thanks to Claude Mamo. 
+o LOG4J2-827:  Support use of TypeConverter classes through the standard Plugin system. 
+o LOG4J2-825:  Add simple validation constraint annotations for the Plugin system. 
+o LOG4J2-428:  Implement a GELF layout. Thanks to Mark Paluch. 
+o LOG4J2-608:  Add java.util.logging implementation based on log4j-api. See log4j-jul documentation for more details. 
+o LOG4J2-793:  Add support for custom SLF4J Markers in log4j-slf4j-impl module. 
+o LOG4J2-771:  Add lookup for application main arguments. 
+o LOG4J2-787:  Add lookup for JVM arguments. 
+
+Fixed Bugs:
+o LOG4J2-866:  Documentation: fixed missing closing parenthesis in code example. Thanks to Gerard Weatherby. 
+o LOG4J2-862:  Fixed classloader issue that prevented Log4j from finding the implementation when used in a custom Ant task. Thanks to Michael Sutherland. 
+o LOG4J2-861:  Documentation: fix broken links on left navigation Extending Log4j Configuration sub-menu. 
+o LOG4J2-797:  Documentation: clarified why log4j-core is a compile time dependency in Maven and Ivy page. Thanks to Andreas Rytina. 
+o LOG4J2-855:  Documentation: fix broken links on Appenders manual page. 
+o LOG4J2-807:  Prevent NPE when configuration with AsyncLogger/AsyncRoot is reloaded. 
+o LOG4J2-678:  Documentation: fixed minor issues with Log4j2 web site/documentation. Thanks to Matt Sicker. 
+o LOG4J2-843:  Migrate JpaHyperSqlAppenderTest JUnit performance test to log4j-perf. 
+o LOG4J2-842:  Migrate JpaH2AppenderTest JUnit performance test to log4j-perf. 
+o LOG4J2-841:  Migrate JdbcHyperSqlAppenderTest JUnit performance test to log4j-perf. 
+o LOG4J2-840:  Migrate JdbcH2AppenderTest JUnit performance test to log4j-perf. 
+o LOG4J2-830:  Respect external interrupt signal to allow application shutdown after joining AsyncAppender thread. 
+o LOG4J2-813:  MarkerManager Log4jMarker.hasParents() returns opposite of correct result. Thanks to David Erichsen, Brandon Barry. 
+o LOG4J2-785:  Documentation: fixed capitalization inconsistency in user manual example config. 
+o LOG4J2-829:  Fixed issue in RollingFile filePattern: backslashes are path separators, not escape characters. 
+o LOG4J2-832:  ThrowableProxy fails if a class in logged stack trace throws java.lang.Error from initializer Thanks to Seth Leger. 
+o LOG4J2-745:  Avoid ConverterKey plugin clashes by using a more predictable plugin loading infrastructure.
+        Plugins have been segmented into three parts: class path, user-specified packages, and OSGi bundles. Thanks to Scott Harrington. 
+o LOG4J2-798:  Fixed plugin scanning redundancy causing massive slowdowns in certain environments. Thanks to Scott Harrington. 
+o LOG4J2-753:  Reduced CachedClock thread contention. 
+o LOG4J2-819:  Fixed memory leak in Tomcat 6 caused by clock background threads unintentionally
+        started by Tomcat after web application stop. Thanks to Gary Gregory. 
+o LOG4J2-391:  FlumePersistentManager now handles LockConflictExceptions in Berkeley Db when sending a batch. Thanks to Kamal Bahadur. 
+o LOG4J2-782:  Remove invalid Oracle Maven repository. 
+o LOG4J2-796:  Fixed issue where log4j-to-slf4j did not work correctly with SLF4J Simple Logger. 
+o LOG4J2-811:  SimpleLogger throws ArrayIndexOutOfBoundsException for an empty array. Thanks to Yogesh Rao. 
+o LOG4J2-663:  Fix OSGi Import-Package problem with the JMS API. Thanks to Florian Brunner. 
+o LOG4J2-783:  PatternLayout should use platform character encoding by default, not UTF-8. Thanks to Minglei Lee. 
+
+Changes:
+o LOG4J2-845:  Add 2.1.0 to compatible versions in Log4j API ProviderUtil and update Log4jAPIVersion to 2.1.0 in
+        core META-INF/log4j-provider.properties. 
+o LOG4J2-844:  Update JMH to 1.1 from 0.7.2. 
+o LOG4J2-831:  Documentation: updated FAQ "which jars" diagrams for JUL bridge and 2.1 version. 
+o LOG4J2-780:  Update Spring Framework to 3.2.11.RELEASE from 3.2.8.RELEASE. 
+o LOG4J2-815:  Unify the two JMS appenders into a single appender. Configurations written for 2.0 will still work in 2.1+. 
+o LOG4J2-790:  Update Jackson to 2.4.2 from 2.4.1 (for XML and JSON processing). 
+o LOG4J2-766:  Incomplete documentation for JSONLayout. Thanks to Bruno P. Kinoshita. 
+o LOG4J2-800:  All life cycle implementations should be serializable.
+        This is still work in progress. 
+o LOG4J2-801:  org.apache.logging.log4j.core.Logger should be serializable.
+        This is still work in progress. 
+o LOG4J2-810:  Update javax.mail to 1.5.2 from 1.5.0. 
+o LOG4J2-822:  Update org.eclipse.persistence.jpa to 2.5.2 from 2.5.1. 
+o LOG4J2-867:  FlumeAppender: maxDelay not in seconds, but milliseconds.
+        Add time scale to some settings, for example maxDelayMillis instead of maxDelay.
+        The old names are aliased for compatibility. 
+
+
+Apache Log4j 2.1 requires a minimum of Java 6 to build and run. Basic compatibility with
+Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the
+very implementation specific classes and methods. The package names and Maven groupId have been changed to
+org.apache.logging.log4j to avoid any conflicts with log4j 1.x.
+
+For complete information on Apache Log4j 2, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Log4j 2 website:
+
+http://logging.apache.org/log4j/2.x/
+
+-------------------------------------------------------------------------------
+
               Apache Log4j 2.0.2 RELEASE NOTES
 
 The Apache Log4j 2 team is pleased to announce the Log4j 2.0.2 release!
@@ -16,25 +112,25 @@ Changes in this version include:
 
 
 Fixed Bugs:
-o LOG4J2-773:  Site: log4j-core component pages were still using the old logo. 
+o LOG4J2-773:  Site: log4j-core component pages were still using the old logo.
 o LOG4J2-760:  Documentation improvement: link to dependency tree from log4j-core component page,
-        link to log4j-core component page from FAQ page. 
-o LOG4J2-679:  Resolved race condition that caused log file rotation to fail with error: "Unable to create directory ..." 
-o LOG4J2-726:  Prevent application from hanging when PatternLayout configuration has opening '{' but no closing '}'. 
-o LOG4J2-769:  Startup takes a long time if you have empty packages attribute. Thanks to Scott Harrington. 
+        link to log4j-core component page from FAQ page.
+o LOG4J2-679:  Resolved race condition that caused log file rotation to fail with error: "Unable to create directory ..."
+o LOG4J2-726:  Prevent application from hanging when PatternLayout configuration has opening '{' but no closing '}'.
+o LOG4J2-769:  Startup takes a long time if you have empty packages attribute. Thanks to Scott Harrington.
 o LOG4J2-763:  Improved asynchronous loggers and appenders to ensure the formatted message does not change even if
         parameters are modified by the application. (ParameterizedMessage was already safe.)
-        Improved documentation. Thanks to Stephen Connolly. 
-o LOG4J2-729:  Emit warning message to console if no configuration file found. 
-o LOG4J2-765:  Improve warning message when missing log4j-core in the classpath. 
-o LOG4J2-722:  Clarified in documentation that Commons Logging jar is required when using log4j-jcl. 
-o LOG4J2-723:  Clarified in documentation that SLF4J API jar is required when using log4j-slf4j-impl. 
-o LOG4J2-759:  Fixed various minor site/documentation issues, mostly versioning related. 
-o LOG4J2-756:  Prevent JUnit test from creating unnecessary Log4j2Plugins.dat during build. Thanks to Scott Harrington. 
+        Improved documentation. Thanks to Stephen Connolly.
+o LOG4J2-729:  Emit warning message to console if no configuration file found.
+o LOG4J2-765:  Improve warning message when missing log4j-core in the classpath.
+o LOG4J2-722:  Clarified in documentation that Commons Logging jar is required when using log4j-jcl.
+o LOG4J2-723:  Clarified in documentation that SLF4J API jar is required when using log4j-slf4j-impl.
+o LOG4J2-759:  Fixed various minor site/documentation issues, mostly versioning related.
+o LOG4J2-756:  Prevent JUnit test from creating unnecessary Log4j2Plugins.dat during build. Thanks to Scott Harrington.
 
 Changes:
-o LOG4J2-775:  Update Apache Flume to 1.5.0.1 from 1.5.0. 
-o LOG4J2-730:  Allow Log4jContextFactory subclasses to specify a custom ContextSelector. 
+o LOG4J2-775:  Update Apache Flume to 1.5.0.1 from 1.5.0.
+o LOG4J2-730:  Allow Log4jContextFactory subclasses to specify a custom ContextSelector.
 
 
 Apache Log4j 2.0.2 requires a minimum of Java 6 to build and run. Basic compatibility with
@@ -47,4 +143,121 @@ patches, or suggestions for improvement, see the Apache Apache Log4j 2 website:
 
 http://logging.apache.org/log4j/2.x/
 
+-------------------------------------------------------------------------------
+
+              Apache Log4j 2.0.1 RELEASE NOTES
+
+The Apache Log4j 2 team is pleased to announce the Log4j 2.0.1 release!
+
+Apache log4j is a well known framework for logging application behavior. Log4j 2 is an upgrade to
+Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides
+many of the improvements available in Logback while fixing some inherent problems in Logback's
+architecture.
+
+This is the first GA release, after thirteen prior releases over the last 4 years.
+
+?
+
+Changes in this version include:
+
+New features:
+o LOG4J2-725:  Added WebLoggerContextUtils class to log4j-web for helper methods useful for asynchronous servlets.
+o LOG4J2-710:  Added documentation for Custom Levels and Custom Loggers.
+
+Fixed Bugs:
+o LOG4J2-744:  Avoid unnecessary Clock calls when TimestampMessage is logged. Thanks to Scott Harrington.
+o LOG4J2-704:  Improved error message if configuration file not found.
+o LOG4J2-750:  Webapp configuration page has incorrect class name. Thanks to Mike Calmus.
+o LOG4J2-749:  Retain the default date pattern after fixing the ISO8601 pattern. Thanks to Scott Harrington.
+o LOG4J2-670:  DatePatternConverter ISO8601_PATTERN now conforms to ISO8601.
+o LOG4J2-741:  Reinstate the package configuration attribute for discovering custom plugins.
+o LOG4J2-742:  XInclude not working with relative path. Thanks to Pascal Chollet.
+o LOG4J2-740:  Fixed typo in webapp manual regarding sample web.xml file. Thanks to Kosta Krauth.
+o LOG4J2-738:  RollingFileManager deadlock if async action thread fails to start. Thanks to Timothy Stack.
+o LOG4J2-736:  Fixed log4j-bom so that it won't specify a default scope on any third party dependencies.
+o LOG4J2-735:  Fixed log4j-bom so that it won't interfere with spring-bom and others.
+o LOG4J2-731:  Updated documentation regarding extensions to LoggerContextFactory and Log4j 2 providers.
+o LOG4J2-373:  Fixed ClassLoader issues in loading Log4j providers in an OSGi environment.
+o LOG4J2-719:  Correctly handle NetworkOnMainThreadException thrown on Android during Log4j2 initialization.
+o LOG4J2-716:  Automatically disable log4j JMX when detecting we are running on Android.
+o LOG4J2-657:  Fixed AbstractDatabaseManager to close connection on writeInternal error. Thanks to Stefan Wehner.
+o LOG4J2-713:  Android: java.lang.VerifyError: org/apache/logging/log4j/core/util/Closer Thanks to Nelson Melina.
+o LOG4J2-703:  Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Thanks to Nelson Melina.
+
+
+
+Apache Log4j 2.0.1 requires a minimum of Java 6 to build and run. Basic compatibility with
+Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the
+very implementation specific classes and methods. The package names and Maven groupId have been changed to
+org.apache.logging.log4j to avoid any conflicts with log4j 1.x.
+
+For complete information on Apache Log4j 2, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Log4j 2 website:
+
+http://logging.apache.org/log4j/2.x/
+
+-------------------------------------------------------------------------------
+
+              Apache Log4j 2.0 RELEASE NOTES
+
+The Apache Log4j 2 team is pleased to announce the Log4j 2.0 release!
+
+Apache log4j is a well known framework for logging application behavior. Log4j 2 is an upgrade to
+Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides
+many of the improvements available in Logback while fixing some inherent problems in Logback's
+architecture.
+
+This is the first GA release, after thirteen prior releases over the last 4 years.
+
+GA Release
+
+Changes in this version include:
+
+New features:
+o LOG4J2-519:  Added support for generating custom logger wrappers that replace the existing log levels
+        and extended logger wrappers that add custom log levels to the existing ones.
+o LOG4J2-696:  RegexFilter does not match multiline log messages.
+
+Fixed Bugs:
+o LOG4J2-705:  Fixed issue where Async Logger does not log thread context stack data.
+        API change: added method getImmutableStackOrNull() to ThreadContext.ContextStack interface.
+o LOG4J2-631:  Update docs to clarify how to use formatter logger and standard logger together.
+o LOG4J2-441:  LoggerConfigs with no Level now inherit the Level from their parent.
+o LOG4J2-703:  Android: Could not find class 'javax.naming.InitialContext', referenced from method org.apache.logging.log4j.core.lookup.JndiLookup.lookup. Thanks to Nelson Melina.
+o LOG4J2-699:  PatternLayout manual page missing documentation on header/footer.
+o LOG4J2-625:  Fixed Serialization error with SocketAppender and Async Loggers.
+        (Fixed in RC2, but wasn't included in release notes.)
+o LOG4J2-538:  JMX GUI: fixed occasional ArrayIndexOutOfBoundsException after pressing "reconfigure with XML below".
+        (Fixed in RC2, but wasn't included in release notes.)
+o LOG4J2-666:  AsyncLoggerContextSelector should ensure that different AsyncLoggerContext objects created by web app classloaders have unique names.
+o LOG4J2-683:  Fix annotation processor warnings on JDK 1.7+. Thanks to Jurriaan Mous.
+o LOG4J2-694:  Fix strange compilation error that popped up in a test class.
+o LOG4J2-692:  Update documentation to specify only Maven 3 is supported.
+o LOG4J2-690:  Log4j Web test dependencies should be in scope "test" in the pom. Thanks to Philip Helger.
+o LOG4J2-682:  Special characters (tab and so on) in PatternLayout do not work. Thanks to Scott Harrington.
+o LOG4J2-686:  Core's OptionConverter support for \b is broken (affects PatternLayout).
+o LOG4J2-687:  Rename org.apache.logging.log4j.core.util.Closer.closeSilent() to closeSilently().
+o LOG4J2-688:  Make org.apache.logging.log4j.core.layout.PatternLayout immutable.
+o LOG4J2-707:  Some exceptions are not logged when configuration problems are detected.
+
+Changes:
+o LOG4J2-685:  Make org.apache.logging.log4j.core.layout.AbstractLayout immutable.
+o LOG4J2-689:  Update Jackson to 2.4.1.
+o LOG4J2-709:  Update Apache Commons Logging to 1.2 from 1.1.3.
+
+
+Apache Log4j 2.0 requires a minimum of Java 6 to build and run. Basic compatibility with
+Log4j 1.x is provided through the log4j-1.2-api component, however it does not implement some of the
+very implementation specific classes and methods. The package names and Maven groupId have been changed to
+org.apache.logging.log4j to avoid any conflicts with log4j 1.x.
+
+For complete information on Apache Log4j 2, including instructions on how to submit bug reports,
+patches, or suggestions for improvement, see the Apache Apache Log4j 2 website:
+
+http://logging.apache.org/log4j/2.x/
+
+
+
+
+
 


[09/15] git commit: Add benchmarks for obtaining stack trace class array.

Posted by ma...@apache.org.
Add benchmarks for obtaining stack trace class array.


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

Branch: refs/heads/master
Commit: 415108f6aac8213e1ab61025d03229b74ba18fd5
Parents: 85f01ff
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:15:49 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:15:49 2014 -0500

----------------------------------------------------------------------
 .../log4j/perf/jmh/ReflectionBenchmark.java     | 32 +++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/415108f6/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
----------------------------------------------------------------------
diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
index 87e83f1..08f6a3d 100644
--- a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
+++ b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/ReflectionBenchmark.java
@@ -22,27 +22,26 @@ import java.util.Random;
 
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.StringFormattedMessage;
-import org.openjdk.jmh.annotations.Benchmark;
 import org.apache.logging.log4j.util.ReflectionUtil;
+import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.Level;
 import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
-
 import sun.reflect.Reflection;
 
 /**
  * <p>
  * Benchmarks the different ways the caller class can be obtained. To run this in sampling mode (latency test):
  * </p>
- * 
+ *
  * <pre>
  *     java -jar benchmarks.jar ".*ReflectionBenchmark.*" -i 5 -f 1 -wi 5 -bm sample -tu ns
  * </pre>
  * <p>
  * To run this in throughput testing mode:
  * </p>
- * 
+ *
  * <pre>
  *     java -jar benchmarks.jar ".*ReflectionBenchmark.*" -i 5 -f 1 -wi 5 -bm Throughput -tu ms
  * </pre>
@@ -62,6 +61,14 @@ public class ReflectionBenchmark {
         }
     }
 
+    @State(Scope.Benchmark)
+    public static class ClassContextManager extends SecurityManager {
+        @Override
+        protected Class[] getClassContext() {
+            return super.getClassContext();
+        }
+    }
+
     @Benchmark
     public void baseline() {
     }
@@ -118,4 +125,21 @@ public class ReflectionBenchmark {
                 Object[].class);
         return constructor.newInstance("Hello %i", new Object[] { rng.random });
     }
+
+    @Benchmark
+    public Class<?>[] test11_getClassContextViaCallerClass() {
+        // let's not benchmark LinkedList or anything here
+        final Class<?>[] classes = new Class<?>[100];
+        Class<?> clazz;
+        for (int i = 0; null != (clazz = ReflectionUtil.getCallerClass(i)); i++) {
+            classes[i] = clazz;
+        }
+        return classes;
+    }
+
+    @Benchmark
+    public Class<?>[] test12_getClassContextViaSecurityManager(final ClassContextManager classContextManager) {
+        return classContextManager.getClassContext();
+    }
+
 }


[04/15] git commit: Update for 2.1 release.

Posted by ma...@apache.org.
Update for 2.1 release.


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

Branch: refs/heads/master
Commit: d83e1dc3478ac08fbaeebe85a7a1df6a1140f9e9
Parents: a870e1a
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 00:21:33 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 09:38:50 2014 -0500

----------------------------------------------------------------------
 pom.xml                 | 4 ++--
 src/changes/changes.xml | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d83e1dc3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a51b81e..ddb0923 100644
--- a/pom.xml
+++ b/pom.xml
@@ -154,8 +154,8 @@
   <properties>
     <!-- make sure to update these for each release! -->
     <log4jParentDir>${basedir}</log4jParentDir>
-    <Log4jReleaseVersion>2.0.2</Log4jReleaseVersion>
-    <Log4jReleaseCount>sixteenth</Log4jReleaseCount>
+    <Log4jReleaseVersion>2.1</Log4jReleaseVersion>
+    <Log4jReleaseCount>seventeenth</Log4jReleaseCount>
     <Log4jReleaseManager>Matt Sicker</Log4jReleaseManager>
     <Log4jReleaseKey>FA1C814D</Log4jReleaseKey>
     <!-- note that any properties you want available in velocity templates must not use periods! -->

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d83e1dc3/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bfbfe96..b4944e6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,7 +23,7 @@
     <title>Changes</title>
   </properties>
   <body>
-    <release version="2.1" date="2014-??-??" description="Bug fixes and enhancements">
+    <release version="2.1" date="2014-10-04" description="GA Release 2.1">
       <action issue="LOG4J2-866" dev="rpopma" type="fix" due-to="Gerard Weatherby">
         Documentation: fixed missing closing parenthesis in code example.
       </action>
@@ -186,7 +186,7 @@
         Update org.eclipse.persistence.jpa to 2.5.2 from 2.5.1.
       </action>
       <action issue="LOG4J2-867" dev="ggregory" type="update">
-        FlumeAppender: maxDelay not in seconds, but milliseconds. 
+        FlumeAppender: maxDelay not in seconds, but milliseconds.
         Add time scale to some settings, for example maxDelayMillis instead of maxDelay.
         The old names are aliased for compatibility.
       </action>


[10/15] git commit: Update LoaderUtil.getCurrentStackTrace() to prefer SecurityManager.

Posted by ma...@apache.org.
Update LoaderUtil.getCurrentStackTrace() to prefer SecurityManager.

  - Based on benchmarks, it's faster to use SecurityManager when
  getting the entire stack trace than to use sun.reflect.Reflection


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

Branch: refs/heads/master
Commit: 599c1f06790800721b2b2bb6ad2553199da51dd0
Parents: 415108f
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:18:30 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:28:14 2014 -0500

----------------------------------------------------------------------
 .../logging/log4j/util/ReflectionUtil.java      | 36 ++++++++++----------
 .../logging/log4j/util/ReflectionUtilTest.java  | 16 +++++----
 2 files changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/599c1f06/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
index 3d95e78..89e7a20 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/ReflectionUtil.java
@@ -90,19 +90,15 @@ public final class ReflectionUtil {
         JDK_7u25_OFFSET = java7u25CompensationOffset;
 
         PrivateSecurityManager psm;
-        if (!SUN_REFLECTION_SUPPORTED) {
-            try {
-                final SecurityManager sm = System.getSecurityManager();
-                if (sm != null) {
-                    sm.checkPermission(new RuntimePermission("createSecurityManager"));
-                }
-                psm = new PrivateSecurityManager();
-            } catch (final SecurityException ignored) {
-                LOGGER.debug(
-                    "Not allowed to create SecurityManager. Falling back to slowest ReflectionUtil implementation.");
-                psm = null;
+        try {
+            final SecurityManager sm = System.getSecurityManager();
+            if (sm != null) {
+                sm.checkPermission(new RuntimePermission("createSecurityManager"));
             }
-        } else {
+            psm = new PrivateSecurityManager();
+        } catch (final SecurityException ignored) {
+            LOGGER.debug(
+                "Not allowed to create SecurityManager. Falling back to slowest ReflectionUtil implementation.");
             psm = null;
         }
         SECURITY_MANAGER = psm;
@@ -227,17 +223,21 @@ public final class ReflectionUtil {
 
     // migrated from ThrowableProxy
     public static Stack<Class<?>> getCurrentStackTrace() {
-        if (supportsFastReflection()) {
+        // benchmarks show that using the SecurityManager is much faster than looping through getCallerClass(int)
+        if (SECURITY_MANAGER != null) {
+            final Class<?>[] array = SECURITY_MANAGER.getClassContext();
             final Stack<Class<?>> classes = new Stack<Class<?>>();
-            Class<?> clazz;
-            for (int i = 1; null != (clazz = getCallerClass(i)); i++) {
+            classes.ensureCapacity(array.length);
+            for (final Class<?> clazz : array) {
                 classes.push(clazz);
             }
             return classes;
-        } else if (SECURITY_MANAGER != null) {
-            final Class<?>[] array = SECURITY_MANAGER.getClassContext();
+        }
+        // slower version using getCallerClass where we cannot use a SecurityManager
+        if (supportsFastReflection()) {
             final Stack<Class<?>> classes = new Stack<Class<?>>();
-            for (final Class<?> clazz : array) {
+            Class<?> clazz;
+            for (int i = 1; null != (clazz = getCallerClass(i)); i++) {
                 classes.push(clazz);
             }
             return classes;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/599c1f06/log4j-api/src/test/java/org/apache/logging/log4j/util/ReflectionUtilTest.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/ReflectionUtilTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/ReflectionUtilTest.java
index 95fb0ad..0a482bb 100644
--- a/log4j-api/src/test/java/org/apache/logging/log4j/util/ReflectionUtilTest.java
+++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/ReflectionUtilTest.java
@@ -73,14 +73,16 @@ public class ReflectionUtilTest {
     @Test
     public void testGetCurrentStackTrace() throws Exception {
         final Stack<Class<?>> classes = ReflectionUtil.getCurrentStackTrace();
-        Class<?> prev = null;
-        Class<?> next = null;
+        final Stack<Class<?>> reversed = new Stack<Class<?>>();
+        reversed.ensureCapacity(classes.size());
         while (!classes.empty()) {
-            prev = next;
-            next = classes.pop();
-//            System.out.println(next);
+            reversed.push(classes.pop());
         }
-        assertSame(ReflectionUtilTest.class, prev);
+        while (reversed.peek() != ReflectionUtil.class) {
+            reversed.pop();
+        }
+        reversed.pop(); // ReflectionUtil
+        assertSame(ReflectionUtilTest.class, reversed.pop());
     }
 
     @Test
@@ -91,4 +93,4 @@ public class ReflectionUtilTest {
         // update this test accordingly
         assertSame(expected, actual);
     }
-}
\ No newline at end of file
+}


[13/15] git commit: Remove use of custom javadoc tag.

Posted by ma...@apache.org.
Remove use of custom javadoc tag.


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

Branch: refs/heads/master
Commit: ee9a05542b0ebfa50ecde6db3eef1c63dc157ff4
Parents: 1ad7be8
Author: Matt Sicker <ma...@apache.org>
Authored: Sat Oct 4 10:48:54 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Sat Oct 4 10:51:11 2014 -0500

----------------------------------------------------------------------
 .../src/test/java/org/apache/logging/slf4j/CustomFlatMarker.java   | 2 +-
 .../src/test/java/org/apache/logging/slf4j/LoggerTest.java         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ee9a0554/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/CustomFlatMarker.java
----------------------------------------------------------------------
diff --git a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/CustomFlatMarker.java b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/CustomFlatMarker.java
index c4b029b..0138cea 100644
--- a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/CustomFlatMarker.java
+++ b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/CustomFlatMarker.java
@@ -23,7 +23,7 @@ import org.slf4j.Marker;
 
 /**
  * Test Marker that may contain no reference/parent Markers.
- * @issue LOG4J2-793
+ * @see <a href="https://issues.apache.org/jira/browse/LOG4J2-793">LOG4J2-793</a>
  */
 public class CustomFlatMarker implements Marker {
     private static final long serialVersionUID = -4115520883240247266L;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/ee9a0554/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
----------------------------------------------------------------------
diff --git a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
index 75e6800..a5e5515 100644
--- a/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
+++ b/log4j-slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
@@ -118,7 +118,7 @@ public class LoggerTest {
     }
 
     /**
-     * @issue LOG4J2-793
+     * @see <a href="https://issues.apache.org/jira/browse/LOG4J2-793">LOG4J2-793</a>
      */
     @Test
     public void supportsCustomSLF4JMarkers() {