actually quieten logs by redirecting jul logging to slf4j

This commit is contained in:
Craig Raw 2021-03-12 18:12:42 +02:00
parent 34080ae8b3
commit 73089ce99c
4 changed files with 9 additions and 1 deletions

View file

@ -71,6 +71,9 @@ dependencies {
} }
implementation('dev.bwt:bwt-jni:0.1.7') implementation('dev.bwt:bwt-jni:0.1.7')
implementation('net.sourceforge.javacsv:javacsv:2.0') implementation('net.sourceforge.javacsv:javacsv:2.0')
implementation('org.slf4j:jul-to-slf4j:1.7.30') {
exclude group: 'org.slf4j'
}
testImplementation('junit:junit:4.12') testImplementation('junit:junit:4.12')
} }

View file

@ -21,6 +21,7 @@ import javafx.stage.Stage;
import org.controlsfx.glyphfont.GlyphFontRegistry; import org.controlsfx.glyphfont.GlyphFontRegistry;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
@ -156,6 +157,8 @@ public class MainApp extends Application {
getLogger().info("Using " + Network.get() + " configuration"); getLogger().info("Using " + Network.get() + " configuration");
} }
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
com.sun.javafx.application.LauncherImpl.launchApplication(MainApp.class, MainAppPreloader.class, argv); com.sun.javafx.application.LauncherImpl.launchApplication(MainApp.class, MainAppPreloader.class, argv);
} }

View file

@ -28,4 +28,5 @@ open module com.sparrowwallet.sparrow {
requires bwt.jni; requires bwt.jni;
requires jtorctl; requires jtorctl;
requires javacsv; requires javacsv;
requires jul.to.slf4j;
} }

View file

@ -1,10 +1,11 @@
<configuration> <configuration>
<statusListener class="ch.qos.logback.core.status.NopStatusListener" /> <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
<logger name="com.github.sarxos.webcam.Webcam" level="OFF"/> <logger name="com.github.sarxos.webcam.Webcam" level="OFF"/>
<logger name="com.github.sarxos.webcam.ds.cgt.WebcamOpenTask" level="OFF"/> <logger name="com.github.sarxos.webcam.ds.cgt.WebcamOpenTask" level="OFF"/>
<logger name="com.github.sarxos.webcam.ds.cgt.WebcamCloseTask" level="OFF"/> <logger name="com.github.sarxos.webcam.ds.cgt.WebcamCloseTask" level="OFF"/>
<logger name="javafx.scene.CssStyleHelper" level="OFF"/> <logger name="javafx.scene.CssStyleHelper" level="ERROR"/>
<define name="appDir" class="com.sparrowwallet.drongo.PropertyDefiner"> <define name="appDir" class="com.sparrowwallet.drongo.PropertyDefiner">
<application>sparrow</application> <application>sparrow</application>