apache / logging-log4j2

Apache Log4j 2 is a versatile, feature-rich, efficient logging API and backend for Java.
https://logging.apache.org/log4j/2.x/
Apache License 2.0
3.39k stars 1.62k forks source link

SyslogAppenderCustomLayoutTest is unreliable #3006

Open garydgregory opened 1 month ago

garydgregory commented 1 month ago

Description

SyslogAppenderCustomLayoutTest is unreliable

[ERROR] Failures:
[ERROR]   SyslogAppenderCustomLayoutTest>SyslogAppenderTest.testTCPAppender:56->SyslogAppenderTestBase.sendAndCheckLegacyBsdMessage:74->SyslogAppenderTestBase.checkTheNumberOfSentAndReceivedMessages:112 The number of received messages should be equal with the number of sent messages expected:<1> but was:<0>
[ERROR]   SyslogAppenderCustomLayoutTest>SyslogAppenderTest.testUDPAppender:79->SyslogAppenderTestBase.sendAndCheckLegacyBsdMessage:74->SyslogAppenderTestBase.checkTheNumberOfSentAndReceivedMessages:112 The number of received messages should be equal with the number of sent messages expected:<1> but was:<0>

Configuration

Version: 2.x at 01125b11a7c52af12204a1c4a646158f63b2d6eb

Operating system: Microsoft Windows [Version 10.0.19045.4780

JDK: Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: C:\java\apache-maven-3.9.9 Java version: 17.0.12, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.12.7-hotspot Default locale: en_US, platform encoding: UTF-8 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Logs

[ERROR] Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 3.549 s <<< FAILURE! -- in org.apache.logging.log4j.core.appender.SyslogAppenderCustomLayoutTest
[INFO] Running org.apache.logging.log4j.core.appender.SmtpAppenderAsyncTest
10:07:11.688 main ERROR The pattern, literal, and isEventTimestamp attributes are mutually exclusive.
[ERROR] org.apache.logging.log4j.core.appender.SyslogAppenderCustomLayoutTest.testTCPAppender -- Time elapsed: 0.225 s <<< FAILURE!
java.lang.AssertionError: The number of received messages should be equal with the number of sent messages expected:<1> but was:<0>
        at org.apache.logging.log4j.core.appender.SyslogAppenderTestBase.checkTheNumberOfSentAndReceivedMessages(SyslogAppenderTestBase.java:112)
        at org.apache.logging.log4j.core.appender.SyslogAppenderTestBase.sendAndCheckLegacyBsdMessage(SyslogAppenderTestBase.java:74)
        at org.apache.logging.log4j.core.appender.SyslogAppenderTest.testTCPAppender(SyslogAppenderTest.java:56)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

[ERROR] org.apache.logging.log4j.core.appender.SyslogAppenderCustomLayoutTest.testUDPAppender -- Time elapsed: 0.209 s <<< FAILURE!
java.lang.AssertionError: The number of received messages should be equal with the number of sent messages expected:<1> but was:<0>
        at org.apache.logging.log4j.core.appender.SyslogAppenderTestBase.checkTheNumberOfSentAndReceivedMessages(SyslogAppenderTestBase.java:112)
        at org.apache.logging.log4j.core.appender.SyslogAppenderTestBase.sendAndCheckLegacyBsdMessage(SyslogAppenderTestBase.java:74)
        at org.apache.logging.log4j.core.appender.SyslogAppenderTest.testUDPAppender(SyslogAppenderTest.java:79)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Reproduction

mvn clean install
garydgregory commented 1 month ago

Just FYI, still an issue with the latest from 2.x:

git log -1
commit b55c4d3fa2489cf91d6569aac57b05ae2c9d4b06 (HEAD -> 2.x, origin/2.x)