vy commented on code in PR #3171:
URL: https://github.com/apache/logging-log4j2/pull/3171#discussion_r2072427609


##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java:
##########
@@ -222,25 +223,31 @@ void testSerializationDeserialization() {
                 new DummyNanoClock(1));
         ((StringMap) evt.getContextData()).putValue("key", "value");
 
-        final RingBufferLogEvent other = 
SerialUtil.deserialize(SerialUtil.serialize(evt));
-        assertThat(other.getLoggerName()).isEqualTo(loggerName);
-        assertThat(other.getMarker()).isEqualTo(marker);
-        assertThat(other.getLoggerFqcn()).isEqualTo(fqcn);
-        assertThat(other.getLevel()).isEqualTo(level);
-        assertThat(other.getMessage()).isEqualTo(data);
-        assertThat(other.getThrown()).isNull();
-        assertThat(other.getThrownProxy()).isEqualTo(new ThrowableProxy(t));
-        assertThat(other.getContextData()).isEqualTo(evt.getContextData());
-        assertThat(other.getContextStack()).isEqualTo(contextStack);
-        assertThat(other.getThreadName()).isEqualTo(threadName);
-        assertThat(other.getSource()).isEqualTo(location);
-        assertThat(other.getTimeMillis()).isEqualTo(12345);
-        assertThat(other.getInstant().getNanoOfMillisecond()).isEqualTo(678);
+        final LogEvent other = 
SerialUtil.deserialize(SerialUtil.serialize(evt));
+        assertThat(other.getLoggerName()).as("Logger 
name").isEqualTo(loggerName);

Review Comment:
   Nit: I wouldn't add to the complexity with extra `as()` calls, since the 
assertion failure line number precisely points to the associated field.



##########
log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEventTranslator.java:
##########
@@ -124,6 +129,11 @@ public void setBasicValues(
         this.nanoClock = aNanoClock;
     }
 
+    /**
+     * @deprecated since 2.25.0. {@link RingBufferLogEventTranslator} 
instances should only be used on the thread that
+     * created it.
+     */
+    @Deprecated

Review Comment:
   Since we removed `AsyncLogger::initTranslatorThreadValues`, usages of this 
method will result in undefined behavior. Shouldn't we throw an `UnsupportedOE` 
in this method?



##########
log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java:
##########
@@ -128,7 +128,9 @@ public <S> void forEachParameter(final ParameterConsumer<S> 
action, final S stat
 
     @Override
     public Message memento() {
-        return new ObjectMessage(obj);
+        Message message = new ObjectMessage(obj);
+        message.getFormattedMessage();

Review Comment:
   I presume you make this call to trigger the stack trace capture. Would you 
mind documenting this, please? (Also in other `message/*Message.java` changes.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to