Browse Source

actually quieten logs by redirecting jul logging to slf4j

terminal
Craig Raw 4 years ago
parent
commit
73089ce99c
  1. 3
      build.gradle
  2. 3
      src/main/java/com/sparrowwallet/sparrow/MainApp.java
  3. 1
      src/main/java/module-info.java
  4. 3
      src/main/resources/logback.xml

3
build.gradle

@ -71,6 +71,9 @@ dependencies {
}
implementation('dev.bwt:bwt-jni:0.1.7')
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')
}

3
src/main/java/com/sparrowwallet/sparrow/MainApp.java

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

1
src/main/java/module-info.java

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

3
src/main/resources/logback.xml

@ -1,10 +1,11 @@
<configuration>
<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.ds.cgt.WebcamOpenTask" 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">
<application>sparrow</application>

Loading…
Cancel
Save