slachiewicz opened a new pull request, #13363: URL: https://github.com/apache/maven/pull/13363
`LookupInvoker.activateLogging()` (since #12344 for #11683) removes the handlers of the `java.util.logging` root logger and installs `SLF4JBridgeHandler`, and nothing puts them back. When Maven runs inside another JVM (embedded, resident, `ToolProvider`), that root logger is the host's: its logging goes to Maven's SLF4J afterwards, and once Maven's realm is closed every `java.util.logging` record fails with `NoClassDefFoundError: org/slf4j/spi/LocationAwareLogger`. Details and the trace are in #13362. `invoke()` already saves and restores the system properties and the context class loader; it now does the same for the root logger's handlers, in the same `finally`. The restore runs after the context is closed, so Maven's own close-time logging still goes through the bridge. Every invocation, resident ones included, goes through `doInvoke()` → `activateLogging()`, which installs the bridge again for the next run. `MavenInvokerTest.restoresJavaUtilLoggingRootHandlers` puts a known `ConsoleHandler` on the root logger, runs `validate`, and checks that it is the only root handler afterwards. Without the fix it fails with `expected: <ConsoleHandler> but was: <SLF4JBridgeHandler>`. With the fix, all 767 maven-cli tests pass. Fixes #13362. apache/maven-executor#68 works around the same issue on the executor side for released Maven 4 versions. If it should also go to maven-4.0.x, I can open the backport. --- - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) 🤖 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]
