Set Tor logging to DEBUG level at startup.

This commit is contained in:
jmacxx 2022-07-08 12:26:58 -05:00
parent 49b5430e49
commit 9893f52e57
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B
2 changed files with 11 additions and 0 deletions

View File

@ -79,6 +79,12 @@ public class Log {
((Logger) LoggerFactory.getLogger(pattern)).setLevel(logLevel);
}
public static String pushCustomLogLevel(String pattern, String logLevel) {
Level oldLevel = ((Logger) LoggerFactory.getLogger(pattern)).getLevel();
((Logger) LoggerFactory.getLogger(pattern)).setLevel(Level.toLevel(logLevel));
return oldLevel == null ? "INFO" : oldLevel.toString();
}
public static void filterByThreadName(String threadName) {
logbackLogger.getLoggerContext().addTurboFilter(new TurboFilter() {
@Override

View File

@ -22,6 +22,7 @@ import bisq.network.utils.Utils;
import bisq.common.Timer;
import bisq.common.UserThread;
import bisq.common.app.Log;
import bisq.common.proto.network.NetworkProtoResolver;
import bisq.common.util.Utilities;
@ -208,6 +209,8 @@ public class TorNetworkNode extends NetworkNode {
private void createTorAndHiddenService(int localPort, int servicePort) {
torStartupFuture = executorService.submit(() -> {
try {
// temporarily switch tor to debug logging
String savedLogLevel = Log.pushCustomLogLevel("org.berndpruenster.netlayer", "DEBUG");
// get tor
Tor.setDefault(torMode.getTor());
@ -222,6 +225,8 @@ public class TorNetworkNode extends NetworkNode {
"Tor hidden service published after {} ms. Socket={}\n" +
"################################################################",
(new Date().getTime() - ts2), socket); //takes usually 30-40 sec
// tor has started, revert from debug to original log level
Log.pushCustomLogLevel("org.berndpruenster.netlayer", savedLogLevel);
new Thread() {
@Override
public void run() {