Skip to content

fix: Mute noisy logging from Apache Lucene#492

Open
chadlwilson wants to merge 1 commit intodependency-check:mainfrom
chadlwilson:quieten-noisy-loggers
Open

fix: Mute noisy logging from Apache Lucene#492
chadlwilson wants to merge 1 commit intodependency-check:mainfrom
chadlwilson:quieten-noisy-loggers

Conversation

@chadlwilson
Copy link
Copy Markdown
Collaborator

Within Gradle we cannot really control the SLF4J logging on behalf of the user, as Gradle uses its own custom implementation. However we can control that for the java.util.logging libraries since JUL allows mutating levels at runtime; so we can mute things before they are propagated to SLF4J via Gradle's interceptors.

This is an analogous change to dependency-check/DependencyCheck#8248 for ant/maven.

Sadly, can't find a way to do anything about Apache HTTPClient which makes the Gradle --debug logging impossible to parse/use with ODC (since it basically logs all responses at debug rather than trace level).

This avoids logging in the Gradle lifecycle of stuff like the first line of the below

You are running with Java 23 or later. To make full use of the Vector API, please update Apache Lucene.
Found 0 vulnerabilities in project gocd

Within Gradle we cannot really control the SLF4J logging on behalf of the user, as Gradle uses its own custom implementation. However we can control that for the java.util.logging libraries since JUL allows mutating levels at runtime; so we can mute things before they are propagated to SLF4J via Gradle's interceptors.

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds logging configuration to mute noisy output from Apache Lucene in Gradle builds. Since Gradle uses its own logging system and custom SLF4J implementation, this change directly configures java.util.logging (JUL) to suppress Lucene's verbose messages at the SEVERE level before they reach Gradle's logging infrastructure.

Changes:

  • Added a static initializer block to DependencyCheckPlugin that configures java.util.logging to mute Apache Lucene loggers
  • Imported necessary java.util.logging classes (Level, LogManager) and StandardCharsets for configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants