ramanathan1504 commented on code in PR #4240:
URL: https://github.com/apache/logging-log4j2/pull/4240#discussion_r4033913639


##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerTest.java:
##########
@@ -121,7 +122,7 @@ public void basicFlow() {
 
     @Test
     public void builder() {
-        final int currentLine = 124;
+        final int currentLine = 125;

Review Comment:
   Back to `124` once the import above is removed.
   
   ```suggestion
           final int currentLine = 124;
   ```



##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerTest.java:
##########
@@ -419,6 +420,17 @@ public void 
getLogger_String_MessageFactoryMismatchNull(final TestInfo testInfo)
                 events.get(0).getMessage().getFormattedMessage());
     }
 
+    @Test
+    public void getLogger_String_MessageFactoryMismatchProducesNoWarning(final 
TestInfo testInfo) {
+        final String name = 
testInfo.getTestMethod().map(Method::getName).orElseThrow(AssertionError::new);
+        testMessageFactoryMismatch(name, 
StringFormatterMessageFactory.INSTANCE, new ReusableMessageFactory());
+        testMessageFactoryMismatch(name + "Null", 
StringFormatterMessageFactory.INSTANCE, null);
+        final boolean mismatchWarning = 
StatusLogger.getLogger().getStatusData().stream()
+                .map(data -> data.getMessage().getFormattedMessage())
+                .anyMatch(message -> message.contains("created with the 
message factory"));
+        assertFalse(mismatchWarning, "The message factory mismatch warning 
should not be emitted");
+    }

Review Comment:
   This passes even when `checkMessageFactory` warns on every call, and the two 
`getLogger_String_MessageFactoryMismatch` tests above already check that each 
factory gets its own logger.
   
   ```suggestion
   ```
   



##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerTest.java:
##########
@@ -52,6 +52,7 @@
 import org.apache.logging.log4j.message.SimpleMessage;
 import org.apache.logging.log4j.message.StringFormatterMessageFactory;
 import org.apache.logging.log4j.message.StructuredDataMessage;
+import org.apache.logging.log4j.status.StatusLogger;

Review Comment:
   Only the new test uses this import, so it goes with the test.
   
   ```suggestion
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to