Affected version
4.0.0-rc-7, master (since #12344 for #11683)
Bug description
LookupInvoker.activateLogging() removes all handlers of the java.util.logging root logger and installs jul-to-slf4j's SLF4JBridgeHandler, and nothing puts the old handlers back. That is fine for mvn run as a process, but the invoker also runs inside other JVMs: embedded (maven-executor's EmbeddedMavenExecutor, ITs), resident invokers, and the ToolProvider. There the root logger belongs to the host JVM, and the handler's classes come from Maven's class realm:
- after the invocation, the host's
java.util.logging output goes to Maven's SLF4J instead of its own handlers (a ConsoleHandler is gone);
- once the realm is closed, every
java.util.logging record of the host fails:
java.lang.NoClassDefFoundError: org/slf4j/spi/LocationAwareLogger
at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:312)
at java.logging/java.util.logging.Logger.log(Logger.java:962)
Caused by: java.lang.ClassNotFoundException: org.slf4j.spi.LocationAwareLogger
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
This fails apache/maven-executor's Windows CI as a surefire executionError (for example on apache/maven-executor#64). To reproduce, run Maven 4.0.0-rc-7 embedded (EmbeddedMavenExecutor, -v), close the executor, then log through java.util.logging.
LookupInvoker.invoke() already saves and restores the system properties and the context class loader around an invocation; the root logger's handlers should get the same treatment. apache/maven-executor#68 works around it on the executor side for released Maven 4 versions.
Affected version
4.0.0-rc-7, master (since #12344 for #11683)
Bug description
LookupInvoker.activateLogging()removes all handlers of thejava.util.loggingroot logger and installs jul-to-slf4j'sSLF4JBridgeHandler, and nothing puts the old handlers back. That is fine formvnrun as a process, but the invoker also runs inside other JVMs: embedded (maven-executor'sEmbeddedMavenExecutor, ITs), resident invokers, and theToolProvider. There the root logger belongs to the host JVM, and the handler's classes come from Maven's class realm:java.util.loggingoutput goes to Maven's SLF4J instead of its own handlers (aConsoleHandleris gone);java.util.loggingrecord of the host fails:This fails apache/maven-executor's Windows CI as a surefire
executionError(for example on apache/maven-executor#64). To reproduce, run Maven 4.0.0-rc-7 embedded (EmbeddedMavenExecutor,-v), close the executor, then log throughjava.util.logging.LookupInvoker.invoke()already saves and restores the system properties and the context class loader around an invocation; the root logger's handlers should get the same treatment. apache/maven-executor#68 works around it on the executor side for released Maven 4 versions.