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/04/22 07:58:43 UTC

[09/15] logging-log4j2 git commit: LOG4J2-1342 added implementation of new method #memento()

LOG4J2-1342 added implementation of new method #memento()


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

Branch: refs/heads/master
Commit: f34a555cd402337af286335b492f2427cfbaff29
Parents: 1c2f168
Author: rpopma <rp...@apache.org>
Authored: Fri Apr 22 14:37:26 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Fri Apr 22 14:37:26 2016 +0900

----------------------------------------------------------------------
 .../apache/logging/log4j/core/async/RingBufferLogEvent.java | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/f34a555c/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
index ab5e3d0..f687ff4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java
@@ -31,6 +31,7 @@ import org.apache.logging.log4j.core.impl.ThrowableProxy;
 import org.apache.logging.log4j.core.lookup.StrSubstitutor;
 import org.apache.logging.log4j.core.util.Constants;
 import org.apache.logging.log4j.message.Message;
+import org.apache.logging.log4j.message.ParameterizedMessage;
 import org.apache.logging.log4j.message.ReusableMessage;
 import org.apache.logging.log4j.message.SimpleMessage;
 import org.apache.logging.log4j.message.TimestampMessage;
@@ -265,6 +266,14 @@ public class RingBufferLogEvent implements LogEvent, ReusableMessage, CharSequen
         return parameterCount;
     }
 
+    @Override
+    public Message memento() {
+        if (message != null) {
+            return message;
+        }
+        Object[] params = parameters == null ? new Object[0] : Arrays.copyOf(parameters, parameterCount);
+        return new ParameterizedMessage(messageText.toString(), params);
+    }
 
     // CharSequence impl