fix: Mute noisy logging from Apache Lucene#492
Open
chadlwilson wants to merge 1 commit intodependency-check:mainfrom
Open
fix: Mute noisy logging from Apache Lucene#492chadlwilson wants to merge 1 commit intodependency-check:mainfrom
chadlwilson wants to merge 1 commit intodependency-check:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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.
src/main/groovy/org/owasp/dependencycheck/gradle/DependencyCheckPlugin.groovy
Show resolved
Hide resolved
src/main/groovy/org/owasp/dependencycheck/gradle/DependencyCheckPlugin.groovy
Show resolved
Hide resolved
src/main/groovy/org/owasp/dependencycheck/gradle/DependencyCheckPlugin.groovy
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
--debuglogging 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