davsclaus opened a new pull request, #30866: URL: https://github.com/apache/camel/pull/30866
# Description [CAMEL-27281](https://issues.apache.org/jira/browse/CAMEL-27281): `QuartzInjectedSchedulerTest` still fails on CI now and then after #30508. The diagnostics that #30508 added show the cause: ``` warnings=[], eventsSeenByAppender=0, appenderStarted=false, appenderAttached=false, loggerConfig=, additive=false, ... ``` The appender was stopped and detached, and the `QuartzComponent` logger was back on the root config, while the test ran. That is what log4j does when it replaces its configuration: the camel-quartz test classes run in parallel, so when this class attaches its appender while another class is still starting log4j, the logger has the `DefaultConfiguration`. `Log4jContextFactory.getContext` only starts a context that is `INITIALIZED`, so a context that another thread is starting is returned as is. Once log4j has read `log4j2.properties`, `LoggerContext.setConfiguration` stops the old configuration, with the appender added to it, and the new one has no config for this logger. A check with jshell (logger and appender set up on a context that is not started yet, then `start()`) gives the same values as the CI failure: `started=false attached=false loggerConfig='' additive=false`. ## Fix `QuartzInjectedSchedulerTest` and `QuartzIgnoredPropertiesFileWarningTest` (same capture, same race) wait until the `LoggerContext` has started before they attach the appender. The diagnostics of `QuartzInjectedSchedulerTest` also report the state and the type of the log4j configuration. ## Tests - The two tests 5 times, and the whole module with `-Dcamel.surefire.forkCount=4 -Dcamel.surefire.parallel=true`: 138 tests, all pass. - The failure did not reproduce locally before the fix (3 full runs of the module), so it is only checked through the jshell check above and the CI diagnostics. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
