slachiewicz opened a new issue, #13362:
URL: https://github.com/apache/maven/issues/13362

   ### 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.
   


-- 
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]

Reply via email to