Skip to content

Commit

Permalink
fix: mute jcs logging (#6130)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong authored Nov 24, 2023
1 parent 8706c3e commit 5a3cef7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public final void execute() throws BuildException {
private void muteJCS() {
if (System.getProperty("jcs.logSystem") == null) {
System.setProperty("jcs.logSystem", "slf4j");
System.setProperty("jcs.logSystem.mute", "true");
}

final String[] noisyLoggers = {
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/java/org/owasp/dependencycheck/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class App {
public static void main(String[] args) {
if (System.getProperty("jcs.logSystem") == null) {
System.setProperty("jcs.logSystem", "slf4j");
System.setProperty("jcs.logSystem.mute", Boolean.toString(!LOGGER.isDebugEnabled()));
}
final int exitCode;
final App app = new App();
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/org/owasp/dependencycheck/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.io.FileUtils;
import org.apache.commons.jcs3.JCS;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.owasp.dependencycheck.analyzer.AnalysisPhase;
Expand Down Expand Up @@ -219,7 +218,6 @@ public void close() {
} else {
System.clearProperty("javax.xml.accessExternalSchema");
}
JCS.shutdown();
}

/**
Expand Down
1 change: 1 addition & 0 deletions core/src/test/java/org/owasp/dependencycheck/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public abstract class BaseTest {
public void setUp() throws Exception {
if (System.getProperty("jcs.logSystem") == null) {
System.setProperty("jcs.logSystem", "slf4j");
System.setProperty("jcs.logSystem.mute", "true");
}
settings = new Settings();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,8 @@ private String[] determineSuppressions() {
private void muteJCS() {
if (System.getProperty("jcs.logSystem") == null) {
System.setProperty("jcs.logSystem", "slf4j");

System.setProperty("jcs.logSystem.mute",Boolean.toString(!getLog().isDebugEnabled()));
}

final String[] noisyLoggers = {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ Copyright (c) 2012 - Jeremy Long
<dependency>
<groupId>io.github.jeremylong</groupId>
<artifactId>jcs3-slf4j</artifactId>
<version>1.0.1</version>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
Expand Down

0 comments on commit 5a3cef7

Please sign in to comment.