mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 23:36:00 -04:00
Improve logging
This commit is contained in:
parent
f700c427a6
commit
b4edbe2986
@ -30,7 +30,7 @@ public class Log {
|
||||
private static SizeBasedTriggeringPolicy triggeringPolicy;
|
||||
private static Logger logbackLogger;
|
||||
|
||||
public static void setup(String fileName, boolean useDetailedLogging) {
|
||||
public static void setup(String fileName) {
|
||||
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
|
||||
RollingFileAppender appender = new RollingFileAppender();
|
||||
@ -60,8 +60,8 @@ public class Log {
|
||||
appender.start();
|
||||
|
||||
logbackLogger = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
|
||||
logbackLogger.setLevel(useDetailedLogging ? Level.TRACE : Level.WARN);
|
||||
logbackLogger.addAppender(appender);
|
||||
logbackLogger.setLevel(Level.INFO);
|
||||
|
||||
// log errors in separate file
|
||||
// not working as expected still.... damn logback...
|
||||
@ -80,6 +80,10 @@ public class Log {
|
||||
logbackLogger.addAppender(errorAppender);*/
|
||||
}
|
||||
|
||||
public static void setLevel(boolean useDetailedLogging) {
|
||||
logbackLogger.setLevel(useDetailedLogging ? Level.TRACE : Level.WARN);
|
||||
}
|
||||
|
||||
public static void traceCall() {
|
||||
if (LoggerFactory.getLogger(Log.class).isTraceEnabled()) {
|
||||
StackTraceElement stackTraceElement = new Throwable().getStackTrace()[1];
|
||||
|
@ -371,7 +371,7 @@ public final class Offer implements StoragePayload, RequiresOwnerIsOnlinePayload
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
log.warn("We don't have a market price.\n" +
|
||||
log.debug("We don't have a market price.\n" +
|
||||
"That case could only happen if you don't have a price feed.");
|
||||
return null;
|
||||
}
|
||||
|
@ -99,10 +99,12 @@ public class BitsquareApp extends Application {
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
String logPath = Paths.get(env.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "bitsquare").toString();
|
||||
Log.setup(logPath, !IS_RELEASE_VERSION);
|
||||
|
||||
Log.setup(logPath);
|
||||
log.info("Log files under: " + logPath);
|
||||
Version.printVersion();
|
||||
Utilities.printSysInfo();
|
||||
Log.setLevel(!IS_RELEASE_VERSION);
|
||||
|
||||
UserThread.setExecutor(Platform::runLater);
|
||||
UserThread.setTimerClass(UITimer.class);
|
||||
|
@ -542,8 +542,12 @@ public class Connection implements MessageListener {
|
||||
} else {
|
||||
// TODO sometimes we get StreamCorruptedException, OptionalDataException, IllegalStateException
|
||||
closeConnectionReason = CloseConnectionReason.UNKNOWN_EXCEPTION;
|
||||
log.warn("Unknown reason for exception at socket {}\n\tconnection={}\n\tException=",
|
||||
socket.toString(), this, e.toString());
|
||||
log.warn("Unknown reason for exception at socket {}\n\t" +
|
||||
"connection={}\n\t" +
|
||||
"Exception=",
|
||||
socket.toString(),
|
||||
this,
|
||||
e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user