You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/06/27 23:23:17 UTC
(maven) 02/02: Guard JUL bridge installation with isInstalled() check
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
commit d260f0d52e29c5f97bcac720e2c30b82ce779455
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Jun 25 05:42:18 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 <no...@anthropic.com>
---
.../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 bf2e0f8c65..76e3316fc0 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()) {