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


##########
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:
   @mthmulders Agree — `maven-cli` is the CLI entry point and is not designed 
for embedding or multi-invocation in the same JVM, so full handler 
snapshotting/restoring is overkill here.
   
   That said, the `isInstalled()` guard added in 989f522 is a pragmatic 
safeguard: it avoids redundantly removing handlers and reinstalling the bridge 
on repeated `activateLogging()` calls, which is cheap and harmless.



##########
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:
   Added unit tests in 9fa0238 covering:
   - Bridge is installed during `activateLogging()`
   - `isInstalled()` guard prevents redundant reinstallation (handler identity 
check)
   - JUL messages are routed through SLF4J after bridge setup



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