Skip to content

Backport #13363: restore the java.util.logging root handlers after an invocation - #13364

Open
slachiewicz wants to merge 1 commit into
maven-4.0.xfrom
gh-13362-restore-jul-root-handlers-4.0.x
Open

slachiewicz wants to merge 1 commit into
maven-4.0.xfrom
gh-13362-restore-jul-root-handlers-4.0.x

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Backport of #13363 to maven-4.0.x: a clean cherry-pick of 5a4fb08.

LookupInvoker.invoke() now restores the handlers of the java.util.logging root logger, which activateLogging() replaces with SLF4JBridgeHandler. That handler otherwise stays installed in the host JVM when Maven runs embedded, resident or through ToolProvider, and once Maven's realm is closed every java.util.logging record of the host fails with NoClassDefFoundError: org/slf4j/spi/LocationAwareLogger (#13362).

Verified on this branch: MavenInvokerTest.restoresJavaUtilLoggingRootHandlers passes, and so do all 752 maven-cli tests, including ResidentMavenInvokerTest.

Fixes #13362 for 4.0.x.

🤖 Generated with Claude Code

…cation

activateLogging() replaces the handlers of the java.util.logging root
logger with SLF4JBridgeHandler and nothing put them back. When Maven runs
inside another JVM (embedded, resident, ToolProvider), the root logger is
that JVM's: its logging went to Maven's SLF4J, and once Maven's realm was
closed every java.util.logging record failed with NoClassDefFoundError:
org/slf4j/spi/LocationAwareLogger. invoke() now restores the handlers like
it restores the system properties and the context class loader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants