This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch maven-4.0.x
in repository https://gitbox.apache.org/repos/asf/maven.git

commit bf1c8672f4db158335dfe4ec87a91fea9436f960
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Jun 25 05:42:20 2026 +0200

    Guard JUL bridge installation with isInstalled() check
    
    Avoid redundantly removing handlers and reinstalling the
    SLF4JBridgeHandler on every activateLogging() call, which matters
    in embedded/resident-mode scenarios where Maven is invoked multiple
    times in the same JVM.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../main/java/org/apache/maven/cling/invoker/LookupInvoker.java    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java
 
b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java
index 459f1046ef..56c7fb83d7 100644
--- 
a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java
+++ 
b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java
@@ -429,9 +429,10 @@ protected Consumer<String> doDetermineWriter(C context) {
     }
 
     protected void activateLogging(C context) throws Exception {
-        // Route java.util.logging (JUL) through SLF4J
-        SLF4JBridgeHandler.removeHandlersForRootLogger();
-        SLF4JBridgeHandler.install();
+        if (!SLF4JBridgeHandler.isInstalled()) {
+            SLF4JBridgeHandler.removeHandlersForRootLogger();
+            SLF4JBridgeHandler.install();
+        }
         context.slf4jConfiguration.activate();
         if (context.options().failOnSeverity().isPresent()) {
             String logLevelThreshold = 
context.options().failOnSeverity().get();

Reply via email to