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/07/31 08:46:53 UTC

[01/11] logging-log4j2 git commit: LOG4J2-1341 (GC) HighlightConverter and StyleConverter are now GC-free.

Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure 339c7ffda -> 64ca77997


LOG4J2-1341 (GC) HighlightConverter and StyleConverter are now GC-free.

This closes GitHub pull request #34 (https://github.com/apache/logging-log4j2/pull/34).


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: c4af088d7d0a181f4e9b84f401bd56f2e1342797
Parents: 8529086
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 14:43:14 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 14:43:14 2016 +0900

----------------------------------------------------------------------
 .../log4j/core/pattern/HighlightConverter.java  | 37 ++++++----
 .../log4j/core/pattern/StyleConverter.java      | 24 ++++--
 .../core/pattern/HighlightConverterTest.java    | 78 ++++++++++++++++++++
 log4j-core/src/test/resources/gcFreeLogging.xml | 10 +--
 .../resources/gcFreeMixedSyncAsyncLogging.xml   | 10 +--
 log4j-core/src/test/resources/log4j-style.xml   |  4 +-
 src/changes/changes.xml                         |  5 +-
 src/site/xdoc/manual/garbagefree.xml            | 10 ++-
 8 files changed, 143 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java
index 0e2f63d..c0ab673 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/HighlightConverter.java
@@ -34,14 +34,14 @@ import org.apache.logging.log4j.util.Strings;
  * <p>
  * For example:
  * </p>
- * 
+ *
  * <pre>
  * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}
  * </pre>
  * <p>
  * You can define custom colors for each Level:
  * </p>
- * 
+ *
  * <pre>
  * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=cyan,
  * TRACE=black}
@@ -49,9 +49,9 @@ import org.apache.logging.log4j.util.Strings;
  * <p>
  * You can use a predefined style:
  * </p>
- * 
+ *
  * <pre>
- * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{STYLE=Log4j}
+ * %highlight{%d{ ISO8601 } [%t] %-5level: %msg%n%throwable}{STYLE=DEFAULT}
  * </pre>
  * <p>
  * The available predefined styles are:
@@ -108,7 +108,7 @@ public final class HighlightConverter extends LogEventPatternConverter implement
      * <p>
      * The format of the option string in {@code option[1]} is:
      * </p>
-     * 
+     *
      * <pre>
      * Level1=Value, Level2=Value, ...
      * </pre>
@@ -193,6 +193,8 @@ public final class HighlightConverter extends LogEventPatternConverter implement
 
     private final boolean noAnsi;
 
+    private final String defaultStyle;
+
     /**
      * Construct the converter.
      *
@@ -205,6 +207,7 @@ public final class HighlightConverter extends LogEventPatternConverter implement
         super("style", "style");
         this.patternFormatters = patternFormatters;
         this.levelStyles = levelStyles;
+        this.defaultStyle = AnsiEscape.getDefaultStyle();
         this.noAnsi = noAnsi;
     }
 
@@ -213,17 +216,25 @@ public final class HighlightConverter extends LogEventPatternConverter implement
      */
     @Override
     public void format(final LogEvent event, final StringBuilder toAppendTo) {
-        final StringBuilder buf = new StringBuilder();
-        for (final PatternFormatter formatter : patternFormatters) {
-            formatter.format(event, buf);
+        final int start = toAppendTo.length();
+        int end = 0;
+        if (!noAnsi) { // use ANSI: set prefix
+            toAppendTo.append(levelStyles.get(event.getLevel()));
+            end = toAppendTo.length();
+        }
+
+        //noinspection ForLoopReplaceableByForEach
+        for (int i = 0, size = patternFormatters.size(); i <  size; i++) {
+            patternFormatters.get(i).format(event, toAppendTo);
         }
 
-        if (buf.length() > 0) {
-            if (noAnsi) {
-                toAppendTo.append(buf.toString());
+        // if we use ANSI we need to add the postfix or erase the unnecessary prefix
+        final boolean empty = toAppendTo.length() == end;
+        if (!noAnsi) {
+            if (empty) {
+                toAppendTo.setLength(start); // erase prefix
             } else {
-                toAppendTo.append(levelStyles.get(event.getLevel())).append(buf.toString()).
-                    append(AnsiEscape.getDefaultStyle());
+                toAppendTo.append(defaultStyle); // add postfix
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/StyleConverter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/StyleConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/StyleConverter.java
index 202d771..0d8c730 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/StyleConverter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/StyleConverter.java
@@ -94,17 +94,25 @@ public final class StyleConverter extends LogEventPatternConverter implements An
      */
     @Override
     public void format(final LogEvent event, final StringBuilder toAppendTo) {
-        final StringBuilder buf = new StringBuilder();
-        for (final PatternFormatter formatter : patternFormatters) {
-            formatter.format(event, buf);
+        int start = 0;
+        int end = 0;
+        if (!noAnsi) { // use ANSI: set prefix
+            start = toAppendTo.length();
+            toAppendTo.append(style);
+            end = toAppendTo.length();
+        }
+
+        //noinspection ForLoopReplaceableByForEach
+        for (int i = 0, size = patternFormatters.size(); i <  size; i++) {
+            patternFormatters.get(i).format(event, toAppendTo);
         }
 
-        if (buf.length() > 0) {
-            if (noAnsi) {
-                // faster to test and do this than setting style and defaultStyle to empty strings.
-                toAppendTo.append(buf.toString());
+        // if we use ANSI we need to add the postfix or erase the unnecessary prefix
+        if (!noAnsi) {
+            if (toAppendTo.length() == end) {
+                toAppendTo.setLength(start); // erase prefix
             } else {
-                toAppendTo.append(style).append(buf.toString()).append(defaultStyle);
+                toAppendTo.append(defaultStyle); // add postfix
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/HighlightConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/HighlightConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/HighlightConverterTest.java
new file mode 100644
index 0000000..6051f85
--- /dev/null
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/HighlightConverterTest.java
@@ -0,0 +1,78 @@
+package org.apache.logging.log4j.core.pattern;/*
+ * 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.
+ */
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.impl.Log4jLogEvent;
+import org.apache.logging.log4j.message.SimpleMessage;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests the HighlightConverter.
+ */
+public class HighlightConverterTest {
+
+    @Test
+    public void testAnsiEmpty() {
+        final String[] options = {"", PatternParser.NO_CONSOLE_NO_ANSI + "=false"};
+        final HighlightConverter converter = HighlightConverter.newInstance(null, options);
+
+        final LogEvent event = Log4jLogEvent.newBuilder().setLevel(Level.INFO).setLoggerName("a.b.c").setMessage(
+                new SimpleMessage("message in a bottle")).build();
+        final StringBuilder buffer = new StringBuilder();
+        converter.format(event, buffer);
+        assertEquals("", buffer.toString());
+    }
+
+    @Test
+    public void testAnsiNonEmpty() {
+        final String[] options = {"%-5level: %msg", PatternParser.NO_CONSOLE_NO_ANSI + "=false"};
+        final HighlightConverter converter = HighlightConverter.newInstance(null, options);
+
+        final LogEvent event = Log4jLogEvent.newBuilder().setLevel(Level.INFO).setLoggerName("a.b.c").setMessage(
+                new SimpleMessage("message in a bottle")).build();
+        final StringBuilder buffer = new StringBuilder();
+        converter.format(event, buffer);
+        assertEquals("\u001B[32mINFO : message in a bottle\u001B[m", buffer.toString());
+    }
+
+    @Test
+    public void testNoAnsiEmpty() {
+        final String[] options = {"", PatternParser.NO_CONSOLE_NO_ANSI + "=true"};
+        final HighlightConverter converter = HighlightConverter.newInstance(null, options);
+
+        final LogEvent event = Log4jLogEvent.newBuilder().setLevel(Level.INFO).setLoggerName("a.b.c").setMessage(
+                new SimpleMessage("message in a bottle")).build();
+        final StringBuilder buffer = new StringBuilder();
+        converter.format(event, buffer);
+        assertEquals("", buffer.toString());
+    }
+
+    @Test
+    public void testNoAnsiNonEmpty() {
+        final String[] options = {"%-5level: %msg", PatternParser.NO_CONSOLE_NO_ANSI + "=true"};
+        final HighlightConverter converter = HighlightConverter.newInstance(null, options);
+
+        final LogEvent event = Log4jLogEvent.newBuilder().setLevel(Level.INFO).setLoggerName("a.b.c").setMessage(
+                new SimpleMessage("message in a bottle")).build();
+        final StringBuilder buffer = new StringBuilder();
+        converter.format(event, buffer);
+        assertEquals("INFO : message in a bottle", buffer.toString());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/log4j-core/src/test/resources/gcFreeLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeLogging.xml b/log4j-core/src/test/resources/gcFreeLogging.xml
index f90d754..8893466 100644
--- a/log4j-core/src/test/resources/gcFreeLogging.xml
+++ b/log4j-core/src/test/resources/gcFreeLogging.xml
@@ -6,13 +6,13 @@
     </Console>
     <File name="File" fileName="target/gcfreefile.log" bufferedIO="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
     </File>
     <RollingFile name="RollingFile" fileName="target/gcfreeRollingFile.log"
         filePattern="target/gcfree-%d{MM-dd-yy-HH-mm-ss}.log.gz">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50M" />
@@ -20,7 +20,7 @@
     </RollingFile>
     <RandomAccessFile name="RandomAccessFile" fileName="target/gcfreeRAF.log" immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %X{aKey} %m %ex%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
       </PatternLayout>
     </RandomAccessFile>
     <RollingRandomAccessFile name="RollingRandomAccessFile"
@@ -28,7 +28,7 @@
         filePattern="target/afterRollover-%i.log" append="false"
         immediateFlush="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %X{aKey} %m %location %ex%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %location %ex%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50 M"/>
@@ -38,7 +38,7 @@
         fileName="target/gcfreemmap.log"
         immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %X{aKey} %m%ex%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m%ex%n}</Pattern>
       </PatternLayout>
     </MemoryMappedFile>
     <RandomAccessFile name="RandomAccessFileGelf" fileName="target/gcfree.json" immediateFlush="false" append="false">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml b/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
index e4c0000..50bff57 100644
--- a/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
+++ b/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
@@ -6,13 +6,13 @@
     </Console>
     <File name="File" fileName="target/gcfreefileMixed.log" bufferedIO="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
     </File>
     <RollingFile name="RollingFile" fileName="target/gcfreeRollingFileMixed.log"
         filePattern="target/gcfree-%d{MM-dd-yy-HH-mm-ss}.log.gz">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50M" />
@@ -20,7 +20,7 @@
     </RollingFile>
     <RandomAccessFile name="RandomAccessFile" fileName="target/gcfreeRAFMixed.log" immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %X{aKey} %m %ex%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
       </PatternLayout>
     </RandomAccessFile>
     <RollingRandomAccessFile name="RollingRandomAccessFile"
@@ -28,7 +28,7 @@
         filePattern="target/afterRollover-%i.log" append="false"
         immediateFlush="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %X{aKey} %m %location %ex%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %location %ex%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50 M"/>
@@ -38,7 +38,7 @@
         fileName="target/gcfreemmapMixed.log"
         immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%d %p %c{1.} [%t] %X{aKey} %m%ex%n</Pattern>
+        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m%ex%n}</Pattern>
       </PatternLayout>
     </MemoryMappedFile>
     <RandomAccessFile name="RandomAccessFileGelf" fileName="target/gcfreeMixed.json" immediateFlush="false" append="false">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/log4j-core/src/test/resources/log4j-style.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-style.xml b/log4j-core/src/test/resources/log4j-style.xml
index 9b18b37..6acf873 100644
--- a/log4j-core/src/test/resources/log4j-style.xml
+++ b/log4j-core/src/test/resources/log4j-style.xml
@@ -20,7 +20,7 @@
   <Appenders>
     <List name="List">
        <PatternLayout>
-         <Pattern>%d %highlight{%p} %style{%logger}{bright,cyan} %C{1.} %msg%n</Pattern>
+         <Pattern>%d %highlight{%p} %style{%logger}{bright,cyan}%style{}{bright,cyan} %C{1.} %msg%n</Pattern>
       </PatternLayout>
     </List>
   </Appenders>
@@ -31,4 +31,4 @@
     </Root>
   </Loggers>
 
-</Configuration>
\ No newline at end of file
+</Configuration>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 8ec3453..25d4b07 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,7 +23,10 @@
     <title>Changes</title>
   </properties>
   <body>
-    <release version="2.7.0" date="2016-MM-DD" description="GA Release 2.7.0">
+    <release version="2.7" date="2016-MM-DD" description="GA Release 2.7.0">
+      <action issue="LOG4J2-1341" dev="rpopma" type="fix" due-to="Richard Zschech">
+        (GC) HighlightConverter and StyleConverter are now GC-free.
+      </action>
       <action issue="LOG4J2-1467" dev="rpopma, ggregory" type="fix" due-to="Ralf, Gary Gregory">
         [OSGi] Missing import package.
       </action>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c4af088d/src/site/xdoc/manual/garbagefree.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/garbagefree.xml b/src/site/xdoc/manual/garbagefree.xml
index 58ca1d0..46499d5 100644
--- a/src/site/xdoc/manual/garbagefree.xml
+++ b/src/site/xdoc/manual/garbagefree.xml
@@ -234,6 +234,14 @@
               </td>
             </tr>
             <tr>
+              <td>%highlight{pattern}{style}</td>
+              <td>Adds ANSI colors (unless nested pattern is not garbage free)</td>
+            </tr>
+            <tr>
+              <td>style{pattern}{ANSI style}</td>
+              <td>Style the message (unless nested pattern is not garbage free)</td>
+            </tr>
+            <tr>
               <td>%m, %msg, %message</td>
               <td>Log message (unless message text contains '${')</td>
             </tr>
@@ -501,4 +509,4 @@ public void garbageFree() {
       </subsection>
     </section>
   </body>
-</document>
\ No newline at end of file
+</document>


[07/11] logging-log4j2 git commit: LOG4J2-1488 (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free.

Posted by rp...@apache.org.
LOG4J2-1488 (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free.

This closes #35 (https://github.com/apache/logging-log4j2/pull/35).


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 291fbf007962c48afb2c86d772a596c4d29a9cf8
Parents: 0a85a77
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 15:53:54 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 15:53:54 2016 +0900

----------------------------------------------------------------------
 .../log4j/core/util/datetime/FixedDateFormat.java        |  7 ++++++-
 .../log4j/core/pattern/DatePatternConverterTest.java     | 11 +++++++++++
 log4j-core/src/test/resources/gcFreeLogging.xml          |  4 ++--
 .../src/test/resources/gcFreeMixedSyncAsyncLogging.xml   |  4 ++--
 src/changes/changes.xml                                  |  3 +++
 5 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/291fbf00/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
index 3b1f102..7232b14 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
@@ -78,7 +78,12 @@ public class FixedDateFormat {
         /**
          * ISO8601 time format: {@code "yyyy-MM-dd'T'HH:mm:ss,SSS"}.
          */
-        ISO8601("yyyy-MM-dd'T'HH:mm:ss,SSS", "yyyy-MM-dd'T'", 2, ':', 1, ',', 1);
+        ISO8601("yyyy-MM-dd'T'HH:mm:ss,SSS", "yyyy-MM-dd'T'", 2, ':', 1, ',', 1),
+
+        /**
+         * ISO8601 time format: {@code "yyyy-MM-dd'T'HH:mm:ss.SSS"}.
+         */
+        ISO8601_PERIOD("yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'", 2, ':', 1, '.', 1);
 
         private final String pattern;
         private final String datePattern;

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/291fbf00/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/DatePatternConverterTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/DatePatternConverterTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/DatePatternConverterTest.java
index 4a5669c..5dc6084 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/DatePatternConverterTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/DatePatternConverterTest.java
@@ -191,6 +191,17 @@ public class DatePatternConverterTest {
     }
 
     @Test
+    public void testFormatDateStringBuilderIso8601WithPeriod() {
+        final String[] pattern = {FixedDateFormat.FixedFormat.ISO8601_PERIOD.name()};
+        final DatePatternConverter converter = DatePatternConverter.newInstance(pattern);
+        final StringBuilder sb = new StringBuilder();
+        converter.format(date(2001, 1, 1), sb);
+
+        final String expected = "2001-02-01T14:15:16.123";
+        assertEquals(expected, sb.toString());
+    }
+
+    @Test
     public void testFormatDateStringBuilderOriginalPattern() {
         final String[] pattern = {"yyyy/MM/dd HH-mm-ss.SSS"};
         final DatePatternConverter converter = DatePatternConverter.newInstance(pattern);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/291fbf00/log4j-core/src/test/resources/gcFreeLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeLogging.xml b/log4j-core/src/test/resources/gcFreeLogging.xml
index 97fc345..d4b597f 100644
--- a/log4j-core/src/test/resources/gcFreeLogging.xml
+++ b/log4j-core/src/test/resources/gcFreeLogging.xml
@@ -12,7 +12,7 @@
     <RollingFile name="RollingFile" fileName="target/gcfreeRollingFile.log"
         filePattern="target/gcfree-%d{MM-dd-yy-HH-mm-ss}.log.gz">
       <PatternLayout>
-        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{yyyy-MM-dd'T'HH:mm:ss,SSS}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50M" />
@@ -20,7 +20,7 @@
     </RollingFile>
     <RandomAccessFile name="RandomAccessFile" fileName="target/gcfreeRAF.log" immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m %ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
+        <Pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS}{UTC} %p %c{1.} [%t] %X{aKey} %m %ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
       </PatternLayout>
     </RandomAccessFile>
     <RollingRandomAccessFile name="RollingRandomAccessFile"

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/291fbf00/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml b/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
index 6944e36..f1937be 100644
--- a/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
+++ b/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
@@ -6,13 +6,13 @@
     </Console>
     <File name="File" fileName="target/gcfreefileMixed.log" bufferedIO="false">
       <PatternLayout>
-        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{yyyy-MM-dd'T'HH:mm:ss,SSS}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
     </File>
     <RollingFile name="RollingFile" fileName="target/gcfreeRollingFileMixed.log"
         filePattern="target/gcfree-%d{MM-dd-yy-HH-mm-ss}.log.gz">
       <PatternLayout>
-        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50M" />

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/291fbf00/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7e44b1b..efd8e52 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1488" dev="rpopma" type="fix" due-to="Richard Zschech">
+        (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free.
+      </action>
       <action issue="LOG4J2-1489" dev="rpopma" type="fix" due-to="Richard Zschech">
         (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free.
       </action>


Re: [08/11] logging-log4j2 git commit: LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).

Posted by Remko Popma <re...@gmail.com>.
Thanks for the reminder!

Sent from my iPhone

> On 2016/08/01, at 2:27, Matt Sicker <bo...@gmail.com> wrote:
> 
> Can you add @since 2.7 for things added to log4j-api?
> 
> ---------- Forwarded message ----------
> From: <rp...@apache.org>
> Date: 31 July 2016 at 03:47
> Subject: [08/11] logging-log4j2 git commit: LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).
> To: commits@logging.apache.org
> 
> 
> LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8803998f
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8803998f
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8803998f
> 
> Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
> Commit: 8803998f3f430f119ebc213c7daaf8001ea4bb90
> Parents: 291fbf0
> Author: rpopma <rp...@apache.org>
> Authored: Sun Jul 31 16:32:06 2016 +0900
> Committer: rpopma <rp...@apache.org>
> Committed: Sun Jul 31 16:32:06 2016 +0900
> 
> ----------------------------------------------------------------------
>  .../org/apache/logging/log4j/message/ObjectMessage.java     | 9 +++++++++
>  .../apache/logging/log4j/message/ReusableObjectMessage.java | 9 +++++++++
>  src/changes/changes.xml                                     | 3 +++
>  3 files changed, 21 insertions(+)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
> ----------------------------------------------------------------------
> diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
> index 7ab9a48..40bb6d6 100644
> --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
> +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
> @@ -94,6 +94,15 @@ public class ObjectMessage implements Message, StringBuilderFormattable {
>      }
> 
>      /**
> +     * Returns the object parameter.
> +     *
> +     * @return The object.
> +     */
> +    public Object getParameter() {
> +        return obj;
> +    }
> +
> +    /**
>       * Returns the object as if it were a parameter.
>       *
>       * @return The object.
> 
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
> ----------------------------------------------------------------------
> diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
> index fb3f176..ec14fbb 100644
> --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
> +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
> @@ -82,6 +82,15 @@ public class ReusableObjectMessage implements ReusableMessage {
>      }
> 
>      /**
> +     * Returns the object parameter.
> +     *
> +     * @return The object.
> +     */
> +    public Object getParameter() {
> +        return obj;
> +    }
> +
> +    /**
>       * Returns the object as if it were a parameter.
>       *
>       * @return The object.
> 
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/src/changes/changes.xml
> ----------------------------------------------------------------------
> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> index efd8e52..da03a3e 100644
> --- a/src/changes/changes.xml
> +++ b/src/changes/changes.xml
> @@ -24,6 +24,9 @@
>    </properties>
>    <body>
>      <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
> +      <action issue="LOG4J2-1438" dev="rpopma" type="fix">
> +        (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).
> +      </action>
>        <action issue="LOG4J2-1488" dev="rpopma" type="fix" due-to="Richard Zschech">
>          (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free.
>        </action>
> 
> 
> 
> 
> -- 
> Matt Sicker <bo...@gmail.com>

Fwd: [08/11] logging-log4j2 git commit: LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).

Posted by Matt Sicker <bo...@gmail.com>.
Can you add @since 2.7 for things added to log4j-api?

---------- Forwarded message ----------
From: <rp...@apache.org>
Date: 31 July 2016 at 03:47
Subject: [08/11] logging-log4j2 git commit: LOG4J2-1438 (GC) Add method
getParameter() to ObjectMessage (and ReusableObjectMessage).
To: commits@logging.apache.org


LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and
ReusableObjectMessage).


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

Branch:
refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 8803998f3f430f119ebc213c7daaf8001ea4bb90
Parents: 291fbf0
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 16:32:06 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 16:32:06 2016 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/message/ObjectMessage.java     | 9 +++++++++
 .../apache/logging/log4j/message/ReusableObjectMessage.java | 9 +++++++++
 src/changes/changes.xml                                     | 3 +++
 3 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
----------------------------------------------------------------------
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
index 7ab9a48..40bb6d6 100644
---
a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
+++
b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
@@ -94,6 +94,15 @@ public class ObjectMessage implements Message,
StringBuilderFormattable {
     }

     /**
+     * Returns the object parameter.
+     *
+     * @return The object.
+     */
+    public Object getParameter() {
+        return obj;
+    }
+
+    /**
      * Returns the object as if it were a parameter.
      *
      * @return The object.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
----------------------------------------------------------------------
diff --git
a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
index fb3f176..ec14fbb 100644
---
a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
+++
b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
@@ -82,6 +82,15 @@ public class ReusableObjectMessage implements
ReusableMessage {
     }

     /**
+     * Returns the object parameter.
+     *
+     * @return The object.
+     */
+    public Object getParameter() {
+        return obj;
+    }
+
+    /**
      * Returns the object as if it were a parameter.
      *
      * @return The object.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index efd8e52..da03a3e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1438" dev="rpopma" type="fix">
+        (GC) Add method getParameter() to ObjectMessage (and
ReusableObjectMessage).
+      </action>
       <action issue="LOG4J2-1488" dev="rpopma" type="fix" due-to="Richard
Zschech">
         (GC) Fixed ISO8601 %date conversion pattern with a period '.'
separator for milliseconds is now garbage free.
       </action>




-- 
Matt Sicker <bo...@gmail.com>

[08/11] logging-log4j2 git commit: LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).

Posted by rp...@apache.org.
LOG4J2-1438 (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 8803998f3f430f119ebc213c7daaf8001ea4bb90
Parents: 291fbf0
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 16:32:06 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 16:32:06 2016 +0900

----------------------------------------------------------------------
 .../org/apache/logging/log4j/message/ObjectMessage.java     | 9 +++++++++
 .../apache/logging/log4j/message/ReusableObjectMessage.java | 9 +++++++++
 src/changes/changes.xml                                     | 3 +++
 3 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
index 7ab9a48..40bb6d6 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
@@ -94,6 +94,15 @@ public class ObjectMessage implements Message, StringBuilderFormattable {
     }
 
     /**
+     * Returns the object parameter.
+     *
+     * @return The object.
+     */
+    public Object getParameter() {
+        return obj;
+    }
+
+    /**
      * Returns the object as if it were a parameter.
      *
      * @return The object.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
index fb3f176..ec14fbb 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
@@ -82,6 +82,15 @@ public class ReusableObjectMessage implements ReusableMessage {
     }
 
     /**
+     * Returns the object parameter.
+     *
+     * @return The object.
+     */
+    public Object getParameter() {
+        return obj;
+    }
+
+    /**
      * Returns the object as if it were a parameter.
      *
      * @return The object.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8803998f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index efd8e52..da03a3e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1438" dev="rpopma" type="fix">
+        (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).
+      </action>
       <action issue="LOG4J2-1488" dev="rpopma" type="fix" due-to="Richard Zschech">
         (GC) Fixed ISO8601 %date conversion pattern with a period '.' separator for milliseconds is now garbage free.
       </action>


[03/11] logging-log4j2 git commit: This closes #34

Posted by rp...@apache.org.
This closes #34


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 907f341cf47d148854a8f7f8a532942691a5be34
Parents: efd9028
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 14:49:29 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 14:49:29 2016 +0900

----------------------------------------------------------------------

----------------------------------------------------------------------



[04/11] logging-log4j2 git commit: LOG4J2-1279 Prevent NullPointerException in FastDateParser$TimeZoneStrategy.

Posted by rp...@apache.org.
LOG4J2-1279 Prevent NullPointerException in FastDateParser$TimeZoneStrategy.

This closes #24 (https://github.com/apache/logging-log4j2/pull/24).


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 2f38e4f622ab03228bda3b1c2f68aa4d58ff9b22
Parents: 907f341
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 15:12:48 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 15:12:48 2016 +0900

----------------------------------------------------------------------
 .../core/util/datetime/FastDateParser.java      | 54 +++++++++++---------
 src/changes/changes.xml                         |  3 ++
 2 files changed, 32 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2f38e4f6/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
index c5f9fdc..7c21aed 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FastDateParser.java
@@ -119,7 +119,7 @@ public class FastDateParser implements DateParser, Serializable {
      * <p>
      * Constructs a new FastDateParser.
      * </p>
-     * 
+     *
      * Use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} or another variation of the factory methods of
      * {@link FastDateFormat} to get a cached FastDateParser instance.
      *
@@ -236,7 +236,7 @@ public class FastDateParser implements DateParser, Serializable {
     // -----------------------------------------------------------------------
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.lang3.time.DateParser#getPattern()
      */
     @Override
@@ -246,7 +246,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.lang3.time.DateParser#getTimeZone()
      */
     @Override
@@ -256,7 +256,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.lang3.time.DateParser#getLocale()
      */
     @Override
@@ -334,7 +334,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String)
      */
     @Override
@@ -344,7 +344,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String)
      */
     @Override
@@ -363,7 +363,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.commons.lang3.time.DateParser#parseObject(java.lang.String, java.text.ParsePosition)
      */
     @Override
@@ -431,7 +431,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Escape constant fields into regular expression
-     * 
+     *
      * @param regex The destination regex
      * @param value The source field
      * @param unquote If true, replace two success quotes ('') with single quote (')
@@ -457,7 +457,7 @@ public class FastDateParser implements DateParser, Serializable {
                 /*
                  * If we have found \E, we replace it with \E\\E\Q, i.e. we stop the quoting, quote the \ in \E, then
                  * restart the quoting.
-                 * 
+                 *
                  * Otherwise we just output the two characters. In each case the initial \ needs to be output and the
                  * final char is done at the end
                  */
@@ -479,7 +479,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Get the short and long values displayed for a field
-     * 
+     *
      * @param field The field of interest
      * @param definingCalendar The calendar to obtain the short and long values
      * @param locale The locale of display names
@@ -492,7 +492,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Adjust dates to be within appropriate century
-     * 
+     *
      * @param twoDigitYear The year to adjust
      * @return A value between centuryStart(inclusive) to centuryStart+100(exclusive)
      */
@@ -503,7 +503,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Is the next field a number?
-     * 
+     *
      * @return true, if next field will be a number
      */
     boolean isNextNumber() {
@@ -512,7 +512,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * What is the width of the current field?
-     * 
+     *
      * @return The number of characters in the current format field
      */
     int getFieldWidth() {
@@ -549,7 +549,7 @@ public class FastDateParser implements DateParser, Serializable {
         /**
          * Generate a <code>Pattern</code> regular expression to the <code>StringBuilder</code> which will accept this
          * field
-         * 
+         *
          * @param parser The parser calling this strategy
          * @param regex The <code>StringBuilder</code> to append to
          * @return true, if this field will set the calendar; false, if this field is a constant value
@@ -566,7 +566,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Obtain a Strategy given a field from a SimpleDateFormat pattern
-     * 
+     *
      * @param formatField A sub-sequence of the SimpleDateFormat pattern
      * @param definingCalendar The calendar to obtain the short and long values
      * @return The Strategy that will handle parsing for the field
@@ -635,7 +635,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Get a cache of Strategies for a particular field
-     * 
+     *
      * @param field The Calendar field
      * @return a cache of Locale to Strategy
      */
@@ -650,7 +650,7 @@ public class FastDateParser implements DateParser, Serializable {
 
     /**
      * Construct a Strategy that parses a Text field
-     * 
+     *
      * @param field The Calendar field
      * @param definingCalendar The calendar to obtain the short and long values
      * @return a TextStrategy for the field and Locale
@@ -677,7 +677,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that ensures the formatField has literal text
-         * 
+         *
          * @param formatField The literal text to match
          */
         CopyQuotedStrategy(final String formatField) {
@@ -716,7 +716,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that parses a Text field
-         * 
+         *
          * @param field The Calendar field
          * @param definingCalendar The Calendar to use
          * @param locale The Locale to use
@@ -772,7 +772,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that parses a Number field
-         * 
+         *
          * @param field The Calendar field
          */
         NumberStrategy(final int field) {
@@ -811,7 +811,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Make any modifications to parsed integer
-         * 
+         *
          * @param iValue The parsed integer
          * @return The modified value
          */
@@ -838,7 +838,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that parses a TimeZone
-         * 
+         *
          * @param locale The Locale
          */
         TimeZoneStrategy(final Locale locale) {
@@ -855,7 +855,11 @@ public class FastDateParser implements DateParser, Serializable {
                 }
                 final TimeZone tz = TimeZone.getTimeZone(tzId);
                 for (int i = 1; i < zoneNames.length; ++i) {
-                    final String zoneName = zoneNames[i].toLowerCase(locale);
+                    final String currentZoneName = zoneNames[i];
+                    if (currentZoneName == null) {
+                        continue;
+                    }
+                    final String zoneName = currentZoneName.toLowerCase(locale);
                     if (!tzNames.containsKey(zoneName)) {
                         tzNames.put(zoneName, tz);
                         simpleQuote(sb.append('|'), zoneName);
@@ -902,7 +906,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Construct a Strategy that parses a TimeZone
-         * 
+         *
          * @param pattern The Pattern
          */
         ISO8601TimeZoneStrategy(final String pattern) {
@@ -936,7 +940,7 @@ public class FastDateParser implements DateParser, Serializable {
 
         /**
          * Factory method for ISO8601TimeZoneStrategies.
-         * 
+         *
          * @param tokenLen a token indicating the length of the TimeZone String to be formatted.
          * @return a ISO8601TimeZoneStrategy that can format TimeZone String of length {@code tokenLen}. If no such
          *         strategy exists, an IllegalArgumentException will be thrown.

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2f38e4f6/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 25d4b07..e4b4bee 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7.0">
+      <action issue="LOG4J2-1279" dev="rpopma" type="fix" due-to="Tony Baines">
+        Prevent NullPointerException in FastDateParser$TimeZoneStrategy.
+      </action>
       <action issue="LOG4J2-1341" dev="rpopma" type="fix" due-to="Richard Zschech">
         (GC) HighlightConverter and StyleConverter are now GC-free.
       </action>


[10/11] logging-log4j2 git commit: LOG4J2-997 This closes #11

Posted by rp...@apache.org.
LOG4J2-997 This closes #11


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 5824cc2040ae8571e16149e91c3176f975465cdf
Parents: 5ae1f3f
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 16:52:26 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 16:52:26 2016 +0900

----------------------------------------------------------------------

----------------------------------------------------------------------



[06/11] logging-log4j2 git commit: LOG4J2-1489 (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free.

Posted by rp...@apache.org.
LOG4J2-1489 (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free.

This closes #36 (https://github.com/apache/logging-log4j2/pull/36).


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 0a85a77481e8ac289d36befb16828a99dd47cb96
Parents: 2bca903
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 15:39:43 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 15:39:43 2016 +0900

----------------------------------------------------------------------
 .../core/pattern/DatePatternConverter.java      |  2 +-
 .../core/util/datetime/FixedDateFormat.java     | 65 +++++++++++++++++---
 .../core/util/datetime/FixedDateFormatTest.java | 35 ++++++++---
 log4j-core/src/test/resources/gcFreeLogging.xml |  9 +--
 .../resources/gcFreeMixedSyncAsyncLogging.xml   | 10 +--
 src/changes/changes.xml                         |  3 +
 6 files changed, 94 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0a85a774/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
index 499f0d9..19edde5 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java
@@ -224,7 +224,7 @@ public final class DatePatternConverter extends LogEventPatternConverter impleme
             LOGGER.warn("Could not instantiate FastDateFormat with pattern " + pattern, e);
 
             // default to the DEFAULT format
-            return createFixedFormatter(FixedDateFormat.create(FixedFormat.DEFAULT));
+            return createFixedFormatter(FixedDateFormat.create(FixedFormat.DEFAULT, tz));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0a85a774/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
index 25a5127..3b1f102 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormat.java
@@ -19,6 +19,7 @@ package org.apache.logging.log4j.core.util.datetime;
 
 import java.util.Calendar;
 import java.util.Objects;
+import java.util.TimeZone;
 
 /**
  * Custom time formatter that trades flexibility for performance. This formatter only supports the date patterns defined
@@ -156,11 +157,23 @@ public class FixedDateFormat {
          * @return the {@code FastDateFormat} object for formatting the date part of the pattern or {@code null}
          */
         public FastDateFormat getFastDateFormat() {
-            return getDatePattern() == null ? null : FastDateFormat.getInstance(getDatePattern());
+            return getFastDateFormat(null);
+        }
+
+        /**
+         * Returns the {@code FastDateFormat} object for formatting the date part of the pattern or {@code null} if the
+         * pattern does not have a date part.
+         *
+         * @param tz the time zone to use
+         * @return the {@code FastDateFormat} object for formatting the date part of the pattern or {@code null}
+         */
+        public FastDateFormat getFastDateFormat(TimeZone tz) {
+            return getDatePattern() == null ? null : FastDateFormat.getInstance(getDatePattern(), tz);
         }
     }
 
     private final FixedFormat fixedFormat;
+    private final TimeZone timeZone;
     private final int length;
     private final FastDateFormat fastDateFormat; // may be null
     private final char timeSeparatorChar;
@@ -186,35 +199,57 @@ public class FixedDateFormat {
      *
      * @param fixedFormat the fixed format
      */
-    FixedDateFormat(final FixedFormat fixedFormat) {
+    FixedDateFormat(final FixedFormat fixedFormat, final TimeZone tz) {
         this.fixedFormat = Objects.requireNonNull(fixedFormat);
+        this.timeZone = Objects.requireNonNull(tz);
         this.timeSeparatorChar = fixedFormat.timeSeparatorChar;
         this.timeSeparatorLength = fixedFormat.timeSeparatorLength;
         this.millisSeparatorChar = fixedFormat.millisSeparatorChar;
         this.millisSeparatorLength = fixedFormat.millisSeparatorLength;
         this.length = fixedFormat.getLength();
-        this.fastDateFormat = fixedFormat.getFastDateFormat();
+        this.fastDateFormat = fixedFormat.getFastDateFormat(tz);
     }
 
     public static FixedDateFormat createIfSupported(final String... options) {
         if (options == null || options.length == 0 || options[0] == null) {
-            return new FixedDateFormat(FixedFormat.DEFAULT);
+            return new FixedDateFormat(FixedFormat.DEFAULT, TimeZone.getDefault());
         }
+        final TimeZone tz;
         if (options.length > 1) {
-            return null; // time zone not supported
+            if (options[1] != null){
+                tz = TimeZone.getTimeZone(options[1]);
+            } else {
+                tz = TimeZone.getDefault();
+            }
+        } else if (options.length > 2) {
+            return null;
+        } else {
+            tz = TimeZone.getDefault();
         }
+
         final FixedFormat type = FixedFormat.lookup(options[0]);
-        return type == null ? null : new FixedDateFormat(type);
+        return type == null ? null : new FixedDateFormat(type, tz);
     }
 
     /**
-     * Returns a new {@code FixedDateFormat} object for the specified {@code FixedFormat} and a {@code null} TimeZone.
+     * Returns a new {@code FixedDateFormat} object for the specified {@code FixedFormat} and a {@code TimeZone.getDefault()} TimeZone.
      *
      * @param format the format to use
      * @return a new {@code FixedDateFormat} object
      */
     public static FixedDateFormat create(final FixedFormat format) {
-        return new FixedDateFormat(format);
+        return new FixedDateFormat(format, TimeZone.getDefault());
+    }
+
+    /**
+     * Returns a new {@code FixedDateFormat} object for the specified {@code FixedFormat} and TimeZone.
+     *
+     * @param format the format to use
+     * @param tz the time zone to use
+     * @return a new {@code FixedDateFormat} object
+     */
+    public static FixedDateFormat create(final FixedFormat format, final TimeZone tz) {
+        return new FixedDateFormat(format, tz != null ? tz : TimeZone.getDefault());
     }
 
     /**
@@ -226,6 +261,16 @@ public class FixedDateFormat {
         return fixedFormat.getPattern();
     }
 
+    /**
+     * Returns the time zone.
+     *
+     * @return the time zone
+     */
+
+    public TimeZone getTimeZone() {
+        return timeZone;
+    }
+
     // Profiling showed this method is important to log4j performance. Modify with care!
     // 30 bytes (allows immediate JVM inlining: <= -XX:MaxInlineSize=35 bytes)
     private long millisSinceMidnight(final long now) {
@@ -243,8 +288,8 @@ public class FixedDateFormat {
         midnightTomorrow = calcMidnightMillis(now, 1);
     }
 
-    static long calcMidnightMillis(final long time, final int addDays) {
-        final Calendar cal = Calendar.getInstance();
+    private long calcMidnightMillis(final long time, final int addDays) {
+        final Calendar cal = Calendar.getInstance(timeZone);
         cal.setTimeInMillis(time);
         cal.set(Calendar.HOUR_OF_DAY, 0);
         cal.set(Calendar.MINUTE, 0);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0a85a774/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
index 0946d73..571e901 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/datetime/FixedDateFormatTest.java
@@ -20,6 +20,7 @@ package org.apache.logging.log4j.core.util.datetime;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Locale;
+import java.util.TimeZone;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.core.util.datetime.FixedDateFormat.FixedFormat;
@@ -114,22 +115,36 @@ public class FixedDateFormatTest {
     public void testCreateIfSupported_defaultIfOptionsArrayWithSingleNullElement() {
         final FixedDateFormat fmt = FixedDateFormat.createIfSupported(new String[1]);
         assertEquals(FixedFormat.DEFAULT.getPattern(), fmt.getFormat());
+        assertEquals(TimeZone.getDefault(), fmt.getTimeZone());
     }
 
     @Test
-    public void testCreateIfSupported_nullIfOptionsArrayHasTwoElements() {
-        final String[] options = {FixedDateFormat.FixedFormat.ABSOLUTE.getPattern(), "+08:00"};
-        assertNull("timezone", FixedDateFormat.createIfSupported(options));
+    public void testCreateIfSupported_defaultTimeZoneIfOptionsArrayWithSecondNullElement() {
+        final FixedDateFormat fmt = FixedDateFormat.createIfSupported(new String[] {FixedFormat.DEFAULT.getPattern(), null, ""});
+        assertEquals(FixedFormat.DEFAULT.getPattern(), fmt.getFormat());
+        assertEquals(TimeZone.getDefault(), fmt.getTimeZone());
+    }
+
+    @Test
+    public void testCreateIfSupported_customTimeZoneIfOptionsArrayWithTimeZoneElement() {
+        final FixedDateFormat fmt = FixedDateFormat.createIfSupported(new String[] {FixedFormat.DEFAULT.getPattern(), "+08:00", ""});
+        assertEquals(FixedFormat.DEFAULT.getPattern(), fmt.getFormat());
+        assertEquals(TimeZone.getTimeZone("+08:00"), fmt.getTimeZone());
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void testConstructorDisallowsNullFormat() {
+        new FixedDateFormat(null, TimeZone.getDefault());
     }
 
     @Test(expected = NullPointerException.class)
-    public void testConstructorDisallowsNull() {
-        new FixedDateFormat(null);
+    public void testConstructorDisallowsNullTimeZone() {
+        new FixedDateFormat(FixedFormat.ABSOLUTE, null);
     }
 
     @Test
     public void testGetFormatReturnsConstructorFixedFormatPattern() {
-        final FixedDateFormat format = new FixedDateFormat(FixedDateFormat.FixedFormat.ABSOLUTE);
+        final FixedDateFormat format = new FixedDateFormat(FixedDateFormat.FixedFormat.ABSOLUTE, TimeZone.getDefault());
         assertSame(FixedDateFormat.FixedFormat.ABSOLUTE.getPattern(), format.getFormat());
     }
 
@@ -140,7 +155,7 @@ public class FixedDateFormatTest {
         final long end = now + TimeUnit.HOURS.toMillis(25);
         for (final FixedFormat format : FixedFormat.values()) {
             final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault());
-            final FixedDateFormat customTF = new FixedDateFormat(format);
+            final FixedDateFormat customTF = new FixedDateFormat(format, TimeZone.getDefault());
             for (long time = start; time < end; time += 12345) {
                 final String actual = customTF.format(time);
                 final String expected = simpleDF.format(new Date(time));
@@ -156,7 +171,7 @@ public class FixedDateFormatTest {
         final long end = now + TimeUnit.HOURS.toMillis(25);
         for (final FixedFormat format : FixedFormat.values()) {
             final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault());
-            final FixedDateFormat customTF = new FixedDateFormat(format);
+            final FixedDateFormat customTF = new FixedDateFormat(format, TimeZone.getDefault());
             for (long time = end; time > start; time -= 12345) {
                 final String actual = customTF.format(time);
                 final String expected = simpleDF.format(new Date(time));
@@ -173,7 +188,7 @@ public class FixedDateFormatTest {
         final char[] buffer = new char[128];
         for (final FixedFormat format : FixedFormat.values()) {
             final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault());
-            final FixedDateFormat customTF = new FixedDateFormat(format);
+            final FixedDateFormat customTF = new FixedDateFormat(format, TimeZone.getDefault());
             for (long time = start; time < end; time += 12345) {
                 final int length = customTF.format(time, buffer, 23);
                 final String actual = new String(buffer, 23, length);
@@ -191,7 +206,7 @@ public class FixedDateFormatTest {
         final char[] buffer = new char[128];
         for (final FixedFormat format : FixedFormat.values()) {
             final SimpleDateFormat simpleDF = new SimpleDateFormat(format.getPattern(), Locale.getDefault());
-            final FixedDateFormat customTF = new FixedDateFormat(format);
+            final FixedDateFormat customTF = new FixedDateFormat(format, TimeZone.getDefault());
             for (long time = end; time > start; time -= 12345) {
                 final int length = customTF.format(time, buffer, 23);
                 final String actual = new String(buffer, 23, length);

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0a85a774/log4j-core/src/test/resources/gcFreeLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeLogging.xml b/log4j-core/src/test/resources/gcFreeLogging.xml
index 8893466..97fc345 100644
--- a/log4j-core/src/test/resources/gcFreeLogging.xml
+++ b/log4j-core/src/test/resources/gcFreeLogging.xml
@@ -6,13 +6,13 @@
     </Console>
     <File name="File" fileName="target/gcfreefile.log" bufferedIO="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
     </File>
     <RollingFile name="RollingFile" fileName="target/gcfreeRollingFile.log"
         filePattern="target/gcfree-%d{MM-dd-yy-HH-mm-ss}.log.gz">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50M" />
@@ -20,7 +20,7 @@
     </RollingFile>
     <RandomAccessFile name="RandomAccessFile" fileName="target/gcfreeRAF.log" immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m %ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
       </PatternLayout>
     </RandomAccessFile>
     <RollingRandomAccessFile name="RollingRandomAccessFile"
@@ -28,7 +28,7 @@
         filePattern="target/afterRollover-%i.log" append="false"
         immediateFlush="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %location %ex%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m %location %ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %location %ex%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50 M"/>
@@ -38,6 +38,7 @@
         fileName="target/gcfreemmap.log"
         immediateFlush="false" append="false">
       <PatternLayout>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m%ex%n</Pattern>
         <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m%ex%n}</Pattern>
       </PatternLayout>
     </MemoryMappedFile>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0a85a774/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml b/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
index 50bff57..6944e36 100644
--- a/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
+++ b/log4j-core/src/test/resources/gcFreeMixedSyncAsyncLogging.xml
@@ -6,13 +6,13 @@
     </Console>
     <File name="File" fileName="target/gcfreefileMixed.log" bufferedIO="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
     </File>
     <RollingFile name="RollingFile" fileName="target/gcfreeRollingFileMixed.log"
         filePattern="target/gcfree-%d{MM-dd-yy-HH-mm-ss}.log.gz">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %m%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %m%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50M" />
@@ -20,7 +20,7 @@
     </RollingFile>
     <RandomAccessFile name="RandomAccessFile" fileName="target/gcfreeRAFMixed.log" immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m %ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %ex%n}</Pattern>
       </PatternLayout>
     </RandomAccessFile>
     <RollingRandomAccessFile name="RollingRandomAccessFile"
@@ -28,7 +28,7 @@
         filePattern="target/afterRollover-%i.log" append="false"
         immediateFlush="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %location %ex%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m %location %ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m %location %ex%n}</Pattern>
       </PatternLayout>
       <Policies>
         <SizeBasedTriggeringPolicy size="50 M"/>
@@ -38,7 +38,7 @@
         fileName="target/gcfreemmapMixed.log"
         immediateFlush="false" append="false">
       <PatternLayout>
-        <Pattern>%highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m%ex%n}</Pattern>
+        <Pattern>%d{DEFAULT}{UTC} %p %c{1.} [%t] %X{aKey} %m%ex%n %highlight{%style{%d}{bright,cyan} %p %c{1.} [%t] %X{aKey} %m%ex%n}</Pattern>
       </PatternLayout>
     </MemoryMappedFile>
     <RandomAccessFile name="RandomAccessFileGelf" fileName="target/gcfreeMixed.json" immediateFlush="false" append="false">

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/0a85a774/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index cbb8466..7e44b1b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1489" dev="rpopma" type="fix" due-to="Richard Zschech">
+        (GC) Fixed %date conversion patterns with a timezone parameter are now garbage free.
+      </action>
       <action issue="LOG4J2-1279" dev="rpopma" type="fix" due-to="Tony Baines">
         Prevent NullPointerException in FastDateParser$TimeZoneStrategy.
       </action>


[11/11] logging-log4j2 git commit: Merge branch 'master' into LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure

Posted by rp...@apache.org.
Merge branch 'master' into LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 64ca77997bb0396a4572158e1c88085c5a16fc54
Parents: 339c7ff 5824cc2
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 17:46:31 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 17:46:31 2016 +0900

----------------------------------------------------------------------
 .../logging/log4j/message/ObjectMessage.java    |  9 +++
 .../log4j/message/ReusableObjectMessage.java    |  9 +++
 .../core/pattern/DatePatternConverter.java      |  2 +-
 .../log4j/core/pattern/HighlightConverter.java  | 37 ++++++----
 .../log4j/core/pattern/StyleConverter.java      | 24 ++++--
 .../core/util/datetime/FastDateParser.java      | 54 +++++++-------
 .../core/util/datetime/FixedDateFormat.java     | 72 +++++++++++++++---
 .../core/pattern/DatePatternConverterTest.java  | 11 +++
 .../core/pattern/HighlightConverterTest.java    | 78 ++++++++++++++++++++
 .../core/util/datetime/FixedDateFormatTest.java | 35 ++++++---
 log4j-core/src/test/resources/gcFreeLogging.xml | 11 +--
 .../resources/gcFreeMixedSyncAsyncLogging.xml   | 10 +--
 log4j-core/src/test/resources/log4j-style.xml   |  4 +-
 src/changes/changes.xml                         | 20 ++++-
 src/site/xdoc/manual/garbagefree.xml            | 10 ++-
 src/site/xdoc/manual/lookups.xml                | 18 ++---
 16 files changed, 313 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/64ca7799/log4j-api/src/main/java/org/apache/logging/log4j/message/ObjectMessage.java
----------------------------------------------------------------------


[05/11] logging-log4j2 git commit: Made description consistent with previous releases.

Posted by rp...@apache.org.
Made description consistent with previous releases.


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 2bca903534f879628fb54abbbb435de764a37c17
Parents: 2f38e4f
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 15:14:05 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 15:14:05 2016 +0900

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/2bca9035/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e4b4bee..cbb8466 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -23,7 +23,7 @@
     <title>Changes</title>
   </properties>
   <body>
-    <release version="2.7" date="2016-MM-DD" description="GA Release 2.7.0">
+    <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
       <action issue="LOG4J2-1279" dev="rpopma" type="fix" due-to="Tony Baines">
         Prevent NullPointerException in FastDateParser$TimeZoneStrategy.
       </action>


[09/11] logging-log4j2 git commit: LOG4J2-1199 Document that JVM Input Arguments Lookup (JMX) is not available on Google App Engine.

Posted by rp...@apache.org.
LOG4J2-1199 Document that JVM Input Arguments Lookup (JMX) is not available on Google App Engine.


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: 5ae1f3feeb96c044294004daf2bead9c8f6b2588
Parents: 8803998
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 16:36:05 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 16:36:05 2016 +0900

----------------------------------------------------------------------
 src/changes/changes.xml          |  3 +++
 src/site/xdoc/manual/lookups.xml | 18 +++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5ae1f3fe/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index da03a3e..b451094 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,9 @@
   </properties>
   <body>
     <release version="2.7" date="2016-MM-DD" description="GA Release 2.7">
+      <action issue="LOG4J2-1199" dev="rpopma" type="fix">
+        Document that JVM Input Arguments Lookup (JMX) is not available on Google App Engine.
+      </action>
       <action issue="LOG4J2-1438" dev="rpopma" type="fix">
         (GC) Add method getParameter() to ObjectMessage (and ReusableObjectMessage).
       </action>

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5ae1f3fe/src/site/xdoc/manual/lookups.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/lookups.xml b/src/site/xdoc/manual/lookups.xml
index 18c508f..f244605 100644
--- a/src/site/xdoc/manual/lookups.xml
+++ b/src/site/xdoc/manual/lookups.xml
@@ -169,17 +169,17 @@
             Use the prefix <code>jvmrunargs</code> to access JVM arguments.
           </p>
           <p>
-            See the Javadocs for 
+            See the Javadocs for
             <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/management/RuntimeMXBean.html#getInputArguments--">
             java.lang.management.RuntimeMXBean.getInputArguments()
             </a>.
           </p>
-          <p><strong>Java's JMX module is not available on Android.</strong></p>
+          <p><strong>Java's JMX module is not available on Android or on Google App Engine.</strong></p>
         </subsection>
         <a name="Log4jConfigLookup"/>
         <subsection name="Log4j Configuration Location Lookup">
           <p>
-            Log4j configuration properties. The expressions 
+            Log4j configuration properties. The expressions
             <code>${log4j:configLocation}</code> and <code>${log4j:configParentLocation}</code>
             respectively provide the absolute path to the log4j configuration file
             and its parent folder.
@@ -284,7 +284,7 @@ public static void main(String args[]) {
     <Pattern>%d %m%n</Pattern>
   </PatternLayout>
 </File>]]></pre>
-        </subsection>  
+        </subsection>
         <a name="MapLookup"/>
         <subsection name="Map Lookup">
           <p>
@@ -363,7 +363,7 @@ Configuration:
     Root:
       level: trace
       AppenderRef:
-        - ref: ROUTING_APPENDER]]></pre>          
+        - ref: ROUTING_APPENDER]]></pre>
           <pre class="prettyprint linenums"><![CDATA[
 public static final Marker SQL = MarkerFactory.getMarker("SQL");
 public static final Marker PAYLOAD = MarkerFactory.getMarker("PAYLOAD");
@@ -380,11 +380,11 @@ logger.info(PERFORMANCE, "Message in Performance.log");]]></pre>
             <code>sql.log</code>, the log event with the <code>PAYLOAD</code> marker to <code>payload.log</code>, and so on.
           </p>
           <p>
-            You can use the notation <code>"${marker:name}"</code> and <code>"$${marker:name}"</code> to check for the 
-            existence of a marker where <code>name</code> is the marker name. If the marker exists, the expression returns 
-            the name, otherwise <code>null</code>. 
+            You can use the notation <code>"${marker:name}"</code> and <code>"$${marker:name}"</code> to check for the
+            existence of a marker where <code>name</code> is the marker name. If the marker exists, the expression returns
+            the name, otherwise <code>null</code>.
           </p>
-        </subsection>        
+        </subsection>
         <a name="StructuredDataLookup"/>
         <subsection name="Structured Data Lookup">
           <p>


[02/11] logging-log4j2 git commit: This closes #7

Posted by rp...@apache.org.
This closes #7


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

Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure
Commit: efd90289139439653d7dfdf94fffa2342e78d7ca
Parents: c4af088
Author: rpopma <rp...@apache.org>
Authored: Sun Jul 31 14:48:51 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jul 31 14:48:51 2016 +0900

----------------------------------------------------------------------

----------------------------------------------------------------------