You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/03/19 06:03:09 UTC

[01/11] logging-log4j2 git commit: LOG4J2-1295 Small improvement in automated GC-free test.

Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1278-gc-free-logger fbe63f5e5 -> 0cda9c483


LOG4J2-1295 Small improvement in automated GC-free test.


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 0e8d40b0e8d02e5528088522afe6209bce19793f
Parents: e39a2da
Author: rpopma <rp...@apache.org>
Authored: Fri Mar 18 07:45:29 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Fri Mar 18 07:45:29 2016 +0900

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0e8d40b0/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
index 2cca348..4a52ff6 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
@@ -93,14 +93,14 @@ public class GcFreeLoggingTest {
                         return; // exclude
                     }
                 }
-                System.out.println("I just allocated the object " + newObj +
+                System.err.println("I just allocated the object " + newObj +
                         " of type " + desc + " whose size is " + size);
                 if (count != -1) {
-                    System.out.println("It's an array of size " + count);
+                    System.err.println("It's an array of size " + count);
                 }
 
-                // uncomment to get a stack trace and see which line caused allocation
-                //new RuntimeException().printStackTrace();
+                // show a stack trace to see which line caused allocation
+                new RuntimeException().printStackTrace();
             }
         };
         Thread.sleep(500);


[02/11] logging-log4j2 git commit: Use final.

Posted by rp...@apache.org.
Use final.


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 49a2f2ce880e927318e1d7afc0120f353c56d555
Parents: 0e8d40b
Author: Matt Sicker <bo...@gmail.com>
Authored: Fri Mar 18 12:12:29 2016 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Fri Mar 18 12:12:29 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/49a2f2ce/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
index 8c4260b..9b651d6 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/LogManager.java
@@ -361,7 +361,7 @@ public class LogManager {
      *            be used.
      * @since 2.6
      */
-    public static void shutdown(boolean currentContext) {
+    public static void shutdown(final boolean currentContext) {
         shutdown(getContext(currentContext));
     }
 
@@ -374,7 +374,7 @@ public class LogManager {
      * @param context the LoggerContext.
      * @since 2.6
      */
-    public static void shutdown(LoggerContext context) {
+    public static void shutdown(final LoggerContext context) {
         if (context != null && context instanceof Terminable) {
             ((Terminable) context).terminate();
         }


[10/11] logging-log4j2 git commit: Format nit.

Posted by rp...@apache.org.
Format nit.

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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 13aadaae9dc3abe680b0ad362b4b7e98f7a167fb
Parents: 3fc4c72
Author: ggregory <gg...@apache.org>
Authored: Fri Mar 18 16:25:52 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Mar 18 16:25:52 2016 -0700

----------------------------------------------------------------------
 .../log4j/core/appender/rolling/DefaultRolloverStrategy.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/13aadaae/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index e56a39a..e3b8ffe 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -230,6 +230,7 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
      * Index for oldest retained log file.
      */
     private final int maxIndex;
+
     /**
      * Index for most recent log file.
      */
@@ -238,7 +239,6 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
     private final StrSubstitutor strSubstitutor;
     private final int compressionLevel;
     private final List<Action> customActions;
-
     private final boolean stopCustomActionsOnError;
 
     /**


[09/11] logging-log4j2 git commit: Better ivar name.

Posted by rp...@apache.org.
Better ivar name.

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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 3fc4c72b4bc2b2df5ed6ac9ebab89da670ad556b
Parents: 72e2e11
Author: ggregory <gg...@apache.org>
Authored: Fri Mar 18 16:25:31 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Mar 18 16:25:31 2016 -0700

----------------------------------------------------------------------
 .../rolling/DefaultRolloverStrategy.java        | 32 ++++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3fc4c72b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index c9de196..e56a39a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -235,7 +235,7 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
      */
     private final int minIndex;
     private final boolean useMax;
-    private final StrSubstitutor subst;
+    private final StrSubstitutor strSubstitutor;
     private final int compressionLevel;
     private final List<Action> customActions;
 
@@ -250,13 +250,13 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
      * @param stopCustomActionsOnError whether to stop executing asynchronous actions if an error occurs
      */
     protected DefaultRolloverStrategy(final int minIndex, final int maxIndex, final boolean useMax,
-            final int compressionLevel, final StrSubstitutor subst, final Action[] customActions,
+            final int compressionLevel, final StrSubstitutor strSubstitutor, final Action[] customActions,
             final boolean stopCustomActionsOnError) {
         this.minIndex = minIndex;
         this.maxIndex = maxIndex;
         this.useMax = useMax;
         this.compressionLevel = compressionLevel;
-        this.subst = subst;
+        this.strSubstitutor = strSubstitutor;
         this.stopCustomActionsOnError = stopCustomActionsOnError;
         this.customActions = customActions == null ? Collections.<Action> emptyList() : Arrays.asList(customActions);
     }
@@ -277,8 +277,8 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         return this.minIndex;
     }
 
-    public StrSubstitutor getSubst() {
-        return subst;
+    public StrSubstitutor getStrSubstitutor() {
+        return strSubstitutor;
     }
 
     public boolean isStopCustomActionsOnError() {
@@ -320,8 +320,8 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         final StringBuilder buf = new StringBuilder();
 
         // LOG4J2-531: directory scan & rollover must use same format
-        manager.getPatternProcessor().formatFileName(subst, buf, highIndex);
-        String highFilename = subst.replace(buf);
+        manager.getPatternProcessor().formatFileName(strSubstitutor, buf, highIndex);
+        String highFilename = strSubstitutor.replace(buf);
         final int suffixLength = suffixLength(highFilename);
         int curMaxIndex = 0;
 
@@ -371,9 +371,9 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
                 // add a rename action to the list
                 buf.setLength(0);
                 // LOG4J2-531: directory scan & rollover must use same format
-                manager.getPatternProcessor().formatFileName(subst, buf, i - 1);
+                manager.getPatternProcessor().formatFileName(strSubstitutor, buf, i - 1);
 
-                final String lowFilename = subst.replace(buf);
+                final String lowFilename = strSubstitutor.replace(buf);
                 String renameTo = lowFilename;
 
                 if (isBase) {
@@ -385,9 +385,9 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
             } else {
                 buf.setLength(0);
                 // LOG4J2-531: directory scan & rollover must use same format
-                manager.getPatternProcessor().formatFileName(subst, buf, i - 1);
+                manager.getPatternProcessor().formatFileName(strSubstitutor, buf, i - 1);
 
-                highFilename = subst.replace(buf);
+                highFilename = strSubstitutor.replace(buf);
             }
         }
         if (curMaxIndex == 0) {
@@ -427,9 +427,9 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         final StringBuilder buf = new StringBuilder();
 
         // LOG4J2-531: directory scan & rollover must use same format
-        manager.getPatternProcessor().formatFileName(subst, buf, lowIndex);
+        manager.getPatternProcessor().formatFileName(strSubstitutor, buf, lowIndex);
 
-        String lowFilename = subst.replace(buf);
+        String lowFilename = strSubstitutor.replace(buf);
         final int suffixLength = suffixLength(lowFilename);
 
         for (int i = lowIndex; i <= highIndex; i++) {
@@ -472,9 +472,9 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
                 // add a rename action to the list
                 buf.setLength(0);
                 // LOG4J2-531: directory scan & rollover must use same format
-                manager.getPatternProcessor().formatFileName(subst, buf, i + 1);
+                manager.getPatternProcessor().formatFileName(strSubstitutor, buf, i + 1);
 
-                final String highFilename = subst.replace(buf);
+                final String highFilename = strSubstitutor.replace(buf);
                 String renameTo = highFilename;
 
                 if (isBase) {
@@ -530,7 +530,7 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
             LOGGER.trace("DefaultRolloverStrategy.purge() took {} milliseconds", durationMillis);
         }
         final StringBuilder buf = new StringBuilder(255);
-        manager.getPatternProcessor().formatFileName(subst, buf, fileIndex);
+        manager.getPatternProcessor().formatFileName(strSubstitutor, buf, fileIndex);
         final String currentFileName = manager.getFileName();
 
         String renameTo = buf.toString();


[06/11] logging-log4j2 git commit: lvar hides ivar.

Posted by rp...@apache.org.
lvar hides ivar.

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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 00c50aeeae5ec1b2c95e3cf03b3893c790978c1c
Parents: d3ab3be
Author: ggregory <gg...@apache.org>
Authored: Fri Mar 18 16:21:25 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Mar 18 16:21:25 2016 -0700

----------------------------------------------------------------------
 .../appender/rolling/DefaultRolloverStrategy.java     | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/00c50aee/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index c618d59..0a54783 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -294,14 +294,14 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         manager.getPatternProcessor().formatFileName(subst, buf, highIndex);
         String highFilename = subst.replace(buf);
         final int suffixLength = suffixLength(highFilename);
-        int maxIndex = 0;
+        int curMaxIndex = 0;
 
         for (int i = highIndex; i >= lowIndex; i--) {
             File toRename = new File(highFilename);
             if (i == highIndex && toRename.exists()) {
-                maxIndex = highIndex;
-            } else if (maxIndex == 0 && toRename.exists()) {
-                maxIndex = i + 1;
+                curMaxIndex = highIndex;
+            } else if (curMaxIndex == 0 && toRename.exists()) {
+                curMaxIndex = i + 1;
                 break;
             }
 
@@ -361,8 +361,8 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
                 highFilename = subst.replace(buf);
             }
         }
-        if (maxIndex == 0) {
-            maxIndex = lowIndex;
+        if (curMaxIndex == 0) {
+            curMaxIndex = lowIndex;
         }
 
         //
@@ -381,7 +381,7 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
                 return -1;
             }
         }
-        return maxIndex;
+        return curMaxIndex;
     }
 
     /**


[03/11] logging-log4j2 git commit: Add LogManager.shutdown() alternatives in migration guide

Posted by rp...@apache.org.
Add LogManager.shutdown() alternatives in migration guide


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 4ee4e28da5d1e7365a399de0489a01abcabcc616
Parents: 49a2f2c
Author: Matt Sicker <bo...@gmail.com>
Authored: Fri Mar 18 12:19:50 2016 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Fri Mar 18 12:19:50 2016 -0500

----------------------------------------------------------------------
 src/site/xdoc/manual/migration.xml | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4ee4e28d/src/site/xdoc/manual/migration.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/migration.xml b/src/site/xdoc/manual/migration.xml
index bd05838..37fe516 100644
--- a/src/site/xdoc/manual/migration.xml
+++ b/src/site/xdoc/manual/migration.xml
@@ -72,6 +72,17 @@
                   Remove calls to <code>org.apache.log4j.LogManager.shutdown()</code>, they are not needed in version 2
                   because the Log4j Core now automatically adds a JVM shutdown hook on start up to perform any Core
                   clean ups.
+                  <ol>
+                    <li>
+                      Starting in Log4j 2.1, you can specify a custom
+                      <a class="javadoc" href="../log4j-core/apidocs/org/apache/logging/log4j/core/util/ShutdownCallbackRegistry.html">ShutdownCallbackRegistry</a>
+                      to override the default JVM shutdown hook strategy.
+                    </li>
+                    <li>
+                      Starting in Log4j 2.6, you can now use <code>org.apache.logging.log4j.LogManager.shutdown()</code>
+                      to initiate shutdown manually.
+                    </li>
+                  </ol>
                 </li>
                 <li>
                   Calls to <code>org.apache.log4j.Logger.setLevel()</code> or similar methods are not supported in the API.


[05/11] logging-log4j2 git commit: Format nit.

Posted by rp...@apache.org.
Format nit.

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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: d3ab3be6e94383ec96765410d53787322216be75
Parents: 63d69ae
Author: ggregory <gg...@apache.org>
Authored: Fri Mar 18 16:18:59 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Mar 18 16:18:59 2016 -0700

----------------------------------------------------------------------
 .../log4j/core/appender/rolling/DefaultRolloverStrategy.java       | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d3ab3be6/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index e014bd7..c618d59 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -191,9 +191,7 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
     private final boolean useMax;
     private final StrSubstitutor subst;
     private final int compressionLevel;
-
     private final List<Action> customActions;
-
     private final boolean stopCustomActionsOnError;
 
     /**


[08/11] logging-log4j2 git commit: Sort methods.

Posted by rp...@apache.org.
Sort methods.

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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 72e2e1180b6df2bd1eccbe2935bfb8f747bf6786
Parents: 856607f
Author: ggregory <gg...@apache.org>
Authored: Fri Mar 18 16:22:54 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Mar 18 16:22:54 2016 -0700

----------------------------------------------------------------------
 .../rolling/DefaultRolloverStrategy.java        | 164 +++++++++----------
 1 file changed, 82 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/72e2e118/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index 119ede0..c9de196 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -131,6 +131,15 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
             }
         };
 
+        static FileExtensions lookup(String fileExtension) {
+            for (FileExtensions ext : values()) {
+                if (ext.isExtensionFor(fileExtension)) {
+                    return ext;
+                }
+            }
+            return null;
+        }
+
         private final String extension;
 
         private FileExtensions(final String extension) {
@@ -138,6 +147,9 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
             this.extension = extension;
         }
 
+        abstract Action createCompressAction(String renameTo, String compressedName, boolean deleteSource,
+                int compressionLevel);
+
         String getExtension() {
             return extension;
         }
@@ -157,18 +169,6 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         File target(String fileName) {
             return new File(fileName);
         }
-
-        abstract Action createCompressAction(String renameTo, String compressedName, boolean deleteSource,
-                int compressionLevel);
-
-        static FileExtensions lookup(String fileExtension) {
-            for (FileExtensions ext : values()) {
-                if (ext.isExtensionFor(fileExtension)) {
-                    return ext;
-                }
-            }
-            return null;
-        }
     };
 
     /**
@@ -180,41 +180,6 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
     private static final int DEFAULT_WINDOW_SIZE = 7;
 
     /**
-     * Index for oldest retained log file.
-     */
-    private final int maxIndex;
-
-    /**
-     * Index for most recent log file.
-     */
-    private final int minIndex;
-    private final boolean useMax;
-    private final StrSubstitutor subst;
-    private final int compressionLevel;
-    private final List<Action> customActions;
-    private final boolean stopCustomActionsOnError;
-
-    /**
-     * Constructs a new instance.
-     * 
-     * @param minIndex The minimum index.
-     * @param maxIndex The maximum index.
-     * @param customActions custom actions to perform asynchronously after rollover
-     * @param stopCustomActionsOnError whether to stop executing asynchronous actions if an error occurs
-     */
-    protected DefaultRolloverStrategy(final int minIndex, final int maxIndex, final boolean useMax,
-            final int compressionLevel, final StrSubstitutor subst, final Action[] customActions,
-            final boolean stopCustomActionsOnError) {
-        this.minIndex = minIndex;
-        this.maxIndex = maxIndex;
-        this.useMax = useMax;
-        this.compressionLevel = compressionLevel;
-        this.subst = subst;
-        this.stopCustomActionsOnError = stopCustomActionsOnError;
-        this.customActions = customActions == null ? Collections.<Action> emptyList() : Arrays.asList(customActions);
-    }
-
-    /**
      * Create the DefaultRolloverStrategy.
      * 
      * @param max The maximum number of files to keep.
@@ -261,10 +226,49 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
                 customActions, stopCustomActionsOnError);
     }
 
+    /**
+     * Index for oldest retained log file.
+     */
+    private final int maxIndex;
+    /**
+     * Index for most recent log file.
+     */
+    private final int minIndex;
+    private final boolean useMax;
+    private final StrSubstitutor subst;
+    private final int compressionLevel;
+    private final List<Action> customActions;
+
+    private final boolean stopCustomActionsOnError;
+
+    /**
+     * Constructs a new instance.
+     * 
+     * @param minIndex The minimum index.
+     * @param maxIndex The maximum index.
+     * @param customActions custom actions to perform asynchronously after rollover
+     * @param stopCustomActionsOnError whether to stop executing asynchronous actions if an error occurs
+     */
+    protected DefaultRolloverStrategy(final int minIndex, final int maxIndex, final boolean useMax,
+            final int compressionLevel, final StrSubstitutor subst, final Action[] customActions,
+            final boolean stopCustomActionsOnError) {
+        this.minIndex = minIndex;
+        this.maxIndex = maxIndex;
+        this.useMax = useMax;
+        this.compressionLevel = compressionLevel;
+        this.subst = subst;
+        this.stopCustomActionsOnError = stopCustomActionsOnError;
+        this.customActions = customActions == null ? Collections.<Action> emptyList() : Arrays.asList(customActions);
+    }
+
     public int getCompressionLevel() {
         return this.compressionLevel;
     }
 
+    public List<Action> getCustomActions() {
+        return customActions;
+    }
+
     public int getMaxIndex() {
         return this.maxIndex;
     }
@@ -273,6 +277,31 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         return this.minIndex;
     }
 
+    public StrSubstitutor getSubst() {
+        return subst;
+    }
+
+    public boolean isStopCustomActionsOnError() {
+        return stopCustomActionsOnError;
+    }
+
+    public boolean isUseMax() {
+        return useMax;
+    }
+
+    private Action merge(final Action compressAction, final List<Action> custom, final boolean stopOnError) {
+        if (custom.isEmpty()) {
+            return compressAction;
+        }
+        if (compressAction == null) {
+            return new CompositeAction(custom, stopOnError);
+        }
+        final List<Action> all = new ArrayList<>();
+        all.add(compressAction);
+        all.addAll(custom);
+        return new CompositeAction(all, stopOnError);
+    }
+
     private int purge(final int lowIndex, final int highIndex, final RollingFileManager manager) {
         return useMax ? purgeAscending(lowIndex, highIndex, manager) : purgeDescending(lowIndex, highIndex, manager);
     }
@@ -479,15 +508,6 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         return lowIndex;
     }
 
-    private int suffixLength(final String lowFilename) {
-        for (FileExtensions extension : FileExtensions.values()) {
-            if (extension.isExtensionFor(lowFilename)) {
-                return extension.length();
-            }
-        }
-        return 0;
-    }
-
     /**
      * Perform the rollover.
      * 
@@ -531,17 +551,13 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         return new RolloverDescriptionImpl(currentFileName, false, renameAction, asyncAction);
     }
 
-    private Action merge(final Action compressAction, final List<Action> custom, final boolean stopOnError) {
-        if (custom.isEmpty()) {
-            return compressAction;
-        }
-        if (compressAction == null) {
-            return new CompositeAction(custom, stopOnError);
+    private int suffixLength(final String lowFilename) {
+        for (FileExtensions extension : FileExtensions.values()) {
+            if (extension.isExtensionFor(lowFilename)) {
+                return extension.length();
+            }
         }
-        final List<Action> all = new ArrayList<>();
-        all.add(compressAction);
-        all.addAll(custom);
-        return new CompositeAction(all, stopOnError);
+        return 0;
     }
 
     @Override
@@ -549,20 +565,4 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         return "DefaultRolloverStrategy(min=" + minIndex + ", max=" + maxIndex + ')';
     }
 
-    public boolean isUseMax() {
-        return useMax;
-    }
-
-    public StrSubstitutor getSubst() {
-        return subst;
-    }
-
-    public List<Action> getCustomActions() {
-        return customActions;
-    }
-
-    public boolean isStopCustomActionsOnError() {
-        return stopCustomActionsOnError;
-    }
-
 }


[04/11] logging-log4j2 git commit: LOG4J2-1322 - Update Log4j 1.x migration guide to include information about system property lookup syntax changes

Posted by rp...@apache.org.
LOG4J2-1322 - Update Log4j 1.x migration guide to include information about system property lookup syntax changes


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 63d69aed2a6066835d0303e69a8d639763b8ec27
Parents: 4ee4e28
Author: Matt Sicker <bo...@gmail.com>
Authored: Fri Mar 18 12:31:45 2016 -0500
Committer: Matt Sicker <bo...@gmail.com>
Committed: Fri Mar 18 12:31:45 2016 -0500

----------------------------------------------------------------------
 src/changes/changes.xml            |  3 +++
 src/site/xdoc/manual/migration.xml | 13 +++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/63d69aed/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5357d96..cdfabf9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -220,6 +220,9 @@
       <action issue="LOG4J2-1169" dev="mattsicker" type="add" due-to="Gerald Kritzinger">
         PatternLayout: Possible variable substitution in equals substitution parameter.
       </action>
+      <action issue="LOG4J2-1322" dev="mattsicker" type="update">
+        Update Log4j 1.x migration guide to include information about system property lookup syntax changes.
+      </action>
     </release>
     <release version="2.5" date="2015-12-06" description="GA Release 2.5">
       <action issue="LOG4J2-324" dev="rpopma" type="fix">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/63d69aed/src/site/xdoc/manual/migration.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/migration.xml b/src/site/xdoc/manual/migration.xml
index 37fe516..4c35c2b 100644
--- a/src/site/xdoc/manual/migration.xml
+++ b/src/site/xdoc/manual/migration.xml
@@ -104,8 +104,17 @@
           <subsection name="Configuring Log4j 2">
             <p>
               Although the Log4j 2 configuration syntax is different than that of Log4j 1.x, most, if not all, of
-              the same functionality is available. Below are the example configurations for Log4j 1.x and their
-              counterparts in Log4j 2.
+              the same functionality is available.
+            </p>
+            <p>
+              Note that system property interpolation via the <code>${foo}</code> syntax has been extended to allow
+              property lookups from many different sources. See the <a href="lookups.html">Lookups</a> documentation
+              for more details. For example, using a lookup for the system property named <code>catalina.base</code>,
+              in Log4j 1.x, the syntax would be <code>${catalina.base}</code>. In Log4j 2, the syntax would be
+              <code>${sys:catalina.base}</code>.
+            </p>
+            <p>
+              Below are the example configurations for Log4j 1.x and their counterparts in Log4j 2.
             </p>
 
             <h4>Sample 1 - Simple configuration using a Console Appender</h4>


[07/11] logging-log4j2 git commit: Add getters for private ivars.

Posted by rp...@apache.org.
Add getters for 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/856607fa
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/856607fa
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/856607fa

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 856607faf268136fc6f2e27cf3716a5e16a0f48d
Parents: 00c50ae
Author: ggregory <gg...@apache.org>
Authored: Fri Mar 18 16:22:29 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Mar 18 16:22:29 2016 -0700

----------------------------------------------------------------------
 .../appender/rolling/DefaultRolloverStrategy.java   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/856607fa/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
index 0a54783..119ede0 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java
@@ -549,4 +549,20 @@ public class DefaultRolloverStrategy implements RolloverStrategy {
         return "DefaultRolloverStrategy(min=" + minIndex + ", max=" + maxIndex + ')';
     }
 
+    public boolean isUseMax() {
+        return useMax;
+    }
+
+    public StrSubstitutor getSubst() {
+        return subst;
+    }
+
+    public List<Action> getCustomActions() {
+        return customActions;
+    }
+
+    public boolean isStopCustomActionsOnError() {
+        return stopCustomActionsOnError;
+    }
+
 }


[11/11] logging-log4j2 git commit: Merge remote-tracking branch 'remotes/origin/master' into LOG4J2-1278-gc-free-logger

Posted by rp...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into LOG4J2-1278-gc-free-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/0cda9c48
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/0cda9c48
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/0cda9c48

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 0cda9c4837b54dee0277cdf93c814afa96ed318b
Parents: fbe63f5 13aadaa
Author: rpopma <rp...@apache.org>
Authored: Sat Mar 19 14:02:36 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Mar 19 14:02:36 2016 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/LogManager.java    |   4 +-
 .../rolling/DefaultRolloverStrategy.java        | 186 ++++++++++---------
 .../logging/log4j/core/GcFreeLoggingTest.java   |   8 +-
 src/changes/changes.xml                         |   3 +
 src/site/xdoc/manual/migration.xml              |  24 ++-
 5 files changed, 131 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0cda9c48/log4j-core/src/test/java/org/apache/logging/log4j/core/GcFreeLoggingTest.java
----------------------------------------------------------------------