Copilot commented on code in PR #12345:
URL: https://github.com/apache/maven/pull/12345#discussion_r3470439229


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java:
##########
@@ -428,6 +429,9 @@ protected Consumer<String> doDetermineWriter(C context) {
     }
 
     protected void activateLogging(C context) throws Exception {
+        // Route java.util.logging (JUL) through SLF4J
+        SLF4JBridgeHandler.removeHandlersForRootLogger();
+        SLF4JBridgeHandler.install();

Review Comment:
   This change introduces new logging behavior (JUL bridging) but there is no 
automated coverage asserting that JUL output is actually routed through 
SLF4J/Maven logging (or that the bridge is installed only once). Adding a 
focused unit test around activateLogging() would help prevent regressions.



##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java:
##########
@@ -428,6 +429,9 @@ protected Consumer<String> doDetermineWriter(C context) {
     }
 
     protected void activateLogging(C context) throws Exception {
+        // Route java.util.logging (JUL) through SLF4J
+        SLF4JBridgeHandler.removeHandlersForRootLogger();
+        SLF4JBridgeHandler.install();

Review Comment:
   Installing the JUL-to-SLF4J bridge here mutates the JVM-wide JUL root logger 
by removing its handlers, but the invoker/context lifecycle otherwise tries to 
restore global state (system properties, streams, etc.). In embedded or 
multi-invocation scenarios this can permanently change JUL behavior for the 
host process. Consider snapshotting/restoring the original root handlers (and 
avoid re-installing if already present).



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