You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2024/01/24 10:44:01 UTC

(logging-log4j2) branch 2.x updated: Further simplify `RingBufferLogEvent` (#2234)

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/2.x by this push:
     new f9cd92fe16 Further simplify `RingBufferLogEvent` (#2234)
f9cd92fe16 is described below

commit f9cd92fe163ca3f00c4f42cbcd68ff448c3be51b
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Wed Jan 24 11:43:52 2024 +0100

    Further simplify `RingBufferLogEvent` (#2234)
---
 .../org/apache/logging/log4j/core/async/RingBufferLogEvent.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 7c6e98e04e..d3ab5a10e8 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
@@ -418,9 +418,7 @@ public class RingBufferLogEvent implements LogEvent, ReusableMessage, CharSequen
         this.level = null;
         this.threadName = null;
         this.loggerName = null;
-        this.message = null;
-        this.messageFormat = null;
-        clearMessageTextAndParameters();
+        clearMessage();
         this.thrown = null;
         this.thrownProxy = null;
         clearContextData();
@@ -431,7 +429,9 @@ public class RingBufferLogEvent implements LogEvent, ReusableMessage, CharSequen
         this.asyncLogger = null;
     }
 
-    private void clearMessageTextAndParameters() {
+    private void clearMessage() {
+        message = null;
+        messageFormat = null;
         // ensure that excessively long char[] arrays are not kept in memory forever
         if (Constants.ENABLE_THREADLOCALS) {
             StringBuilders.trimToMaxSize(messageText, Constants.MAX_REUSABLE_MESSAGE_SIZE);