Hi Gary,
On 9.11.2024 14:11, Gary Gregory wrote:
I get this failure:
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
4.963 s <<< FAILURE! -- in
org.apache.logging.log4j.core.appender.rolling.RollingAppenderDirectCronTest
[ERROR]
org.apache.logging.log4j.core.appender.rolling.RollingAppenderDirectCronTest.testAppender(LoggerContext,
RollingFileAppender) -- Time elapsed: 4.601 s <<< FAILURE!
Details:
https://gist.github.com/garydgregory/889c0b9aaea1edc3aa56cad075802b83
The tests of the rolling appender and especially those that use the
`CronTriggeringPolicy` are notably flaky[1]. I am keeping them for lack
of a better alternative, but they should probably be rewritten from
scratch. Since the `CronTriggeringPolicy` always performs rollovers
asynchronously, we should decide:
1. How synchronized should the tests be? I can pretty much modify them
so that log statements and rollovers happen sequentially in a predefined
order. Would that be a good test?
2. The tests are in my opinion overspecified: they make assertions on
the content of a log file. Those assertions should probably be dropped
and left to the layout unit tests. In the case of the
`CronTriggeringPolicy` tests, we can not even make assertions on the
relative position of the log event timestamp to the rollover timestamp.
They can be arbitrary.
In the gist you shared above, nothing indicates that the rolling
appender is malfunctioning: the status logger shows at least on rollover.
Piotr
[1]
https://ge.apache.org/scans/tests?search.rootProjectNames=Apache%20Log4j%20BOM&search.timeZoneId=Europe%2FWarsaw