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/31 02:24:42 UTC

[1/4] logging-log4j2 git commit: LOG4J2-1296 bugfix & added test for scenario where parameters need to be passed to layout rather than formatted message (CsvParameterLayout)

Repository: logging-log4j2
Updated Branches:
  refs/heads/LOG4J2-1278-gc-free-logger 8fa9284c8 -> 1d18f839e


LOG4J2-1296	bugfix & added test for scenario where parameters need to be passed to layout rather than formatted message (CsvParameterLayout)


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 5106fd84337d404075030f6f7f83c5af5345aea8
Parents: bd34d17
Author: rpopma <rp...@apache.org>
Authored: Thu Mar 31 09:21:16 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Mar 31 09:21:16 2016 +0900

----------------------------------------------------------------------
 .../log4j/message/ReusableParameterizedMessage.java       | 10 ++++++----
 .../logging/log4j/core/layout/CsvParameterLayoutTest.java |  8 ++++----
 2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5106fd84/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableParameterizedMessage.java
----------------------------------------------------------------------
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableParameterizedMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableParameterizedMessage.java
index 66a0601..0c099cf 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableParameterizedMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableParameterizedMessage.java
@@ -35,6 +35,7 @@ public class ReusableParameterizedMessage implements ReusableMessage {
 
     private String messagePattern;
     private int argCount;
+    private int usedCount;
     private int[] indices = new int[256];
     private transient Object[] varargs;
     private transient Object[] params = new Object[10];
@@ -57,9 +58,10 @@ public class ReusableParameterizedMessage implements ReusableMessage {
     private void init(final String messagePattern, final int argCount, final Object[] paramArray) {
         this.varargs = null;
         this.messagePattern = messagePattern;
-        int usedCount = count(messagePattern, indices);
-        initThrowable(paramArray, argCount,usedCount);
-        this.argCount = Math.min(usedCount, argCount);
+        this.argCount = argCount;
+        int placeholderCount = count(messagePattern, indices);
+        initThrowable(paramArray, argCount, placeholderCount);
+        this.usedCount = Math.min(placeholderCount, argCount);
     }
 
     private static int count(final String messagePattern, final int[] indices) {
@@ -251,7 +253,7 @@ public class ReusableParameterizedMessage implements ReusableMessage {
         if (indices[0] < 0) {
             ParameterFormatter.formatMessage(buffer, messagePattern, getParams(), argCount);
         } else {
-            ParameterFormatter.formatMessage2(buffer, messagePattern, getParams(), argCount, indices);
+            ParameterFormatter.formatMessage2(buffer, messagePattern, getParams(), usedCount, indices);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/5106fd84/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java
index 5c80a01..5f58d79 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java
@@ -113,10 +113,10 @@ public class CsvParameterLayoutTest {
     }
 
     private void logDebugNormalApi() {
-        root.debug("{}{}{}", 1, 2, 3);
-        root.debug("{}{}{}", 2, 3);
-        root.debug("{}{}{}", 5, 6);
-        root.debug("{}{}{}", 7, 8, 9, 10);
+        root.debug("with placeholders: {}{}{}", 1, 2, 3);
+        root.debug("without placeholders", 2, 3);
+        root.debug(null, 5, 6);
+        root.debug("invalid placeholder count {}", 7, 8, 9, 10);
     }
 
     private void logDebugObjectArrayMessage() {


[3/4] 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/f21bc88b
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/f21bc88b
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/f21bc88b

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: f21bc88b964348a6c5899c4f0dc7d3999528824c
Parents: fed3446 c78333e
Author: rpopma <rp...@apache.org>
Authored: Thu Mar 31 09:24:13 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Mar 31 09:24:13 2016 +0900

----------------------------------------------------------------------
 .../log4j/message/ReusableParameterizedMessage.java       | 10 ++++++----
 .../logging/log4j/core/layout/CsvParameterLayoutTest.java |  8 ++++----
 log4j-core/src/test/resources/gcFreeLogging.xml           |  4 +++-
 3 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



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

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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 1d18f839e96b41993ec613db98534a0302003463
Parents: f21bc88 8fa9284
Author: rpopma <rp...@apache.org>
Authored: Thu Mar 31 09:24:53 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Mar 31 09:24:53 2016 +0900

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

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



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

Posted by rp...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: c78333ef0114dc1daf95645a860904e0c0ea8ffc
Parents: 5106fd8 75e104f
Author: rpopma <rp...@apache.org>
Authored: Thu Mar 31 09:21:39 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Thu Mar 31 09:21:39 2016 +0900

----------------------------------------------------------------------
 log4j-core/src/test/resources/gcFreeLogging.xml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------