mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-20 13:54:32 +01:00
Merge pull request #5818 from chimp1984/small-debugging-utils
Small debugging utils
This commit is contained in:
commit
9a1dc43088
3 changed files with 22 additions and 2 deletions
|
@ -18,18 +18,22 @@
|
|||
package bisq.common.app;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Marker;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.classic.turbo.TurboFilter;
|
||||
import ch.qos.logback.core.rolling.FixedWindowRollingPolicy;
|
||||
import ch.qos.logback.core.rolling.RollingFileAppender;
|
||||
import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy;
|
||||
import ch.qos.logback.core.spi.FilterReply;
|
||||
import ch.qos.logback.core.util.FileSize;
|
||||
|
||||
public class Log {
|
||||
public static final String JAVA_FX_THREAD_NAME = "JavaFX Application Thread";
|
||||
private static Logger logbackLogger;
|
||||
public static final Level DEFAULT_LOG_LEVEL = Level.INFO;
|
||||
|
||||
|
@ -74,4 +78,19 @@ public class Log {
|
|||
public static void setCustomLogLevel(String pattern, Level logLevel) {
|
||||
((Logger) LoggerFactory.getLogger(pattern)).setLevel(logLevel);
|
||||
}
|
||||
|
||||
public static void filterByThreadName(String threadName) {
|
||||
logbackLogger.getLoggerContext().addTurboFilter(new TurboFilter() {
|
||||
@Override
|
||||
public FilterReply decide(Marker marker, Logger logger, Level level, String format,
|
||||
Object[] params, Throwable t) {
|
||||
return threadName.equals(Thread.currentThread().getName()) ?
|
||||
FilterReply.ACCEPT : FilterReply.DENY;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void clearFilters() {
|
||||
logbackLogger.getLoggerContext().resetTurboFilterList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,10 +64,11 @@ public class GcUtil {
|
|||
long postGcMemory = Runtime.getRuntime().totalMemory();
|
||||
long duration = System.currentTimeMillis() - ts;
|
||||
totalGCTime += duration;
|
||||
log.info("GC reduced memory by {}. Total memory before/after: {}/{}. Took {} ms. Total GC invocations: {} / Total GC time {} sec",
|
||||
log.info("GC reduced memory by {}. Total memory before/after: {}/{}. Free memory: {}. Took {} ms. Total GC invocations: {} / Total GC time {} sec",
|
||||
Utilities.readableFileSize(preGcMemory - postGcMemory),
|
||||
Utilities.readableFileSize(preGcMemory),
|
||||
Utilities.readableFileSize(postGcMemory),
|
||||
Utilities.readableFileSize(Runtime.getRuntime().freeMemory()),
|
||||
duration,
|
||||
totalInvocations,
|
||||
totalGCTime / 1000d);
|
||||
|
|
|
@ -603,7 +603,7 @@ public abstract class ChartView<T extends ChartViewModel<? extends ChartDataMode
|
|||
updateTimeLinePositions();
|
||||
|
||||
model.invalidateCache();
|
||||
applyDataAndUpdate(); //3
|
||||
applyDataAndUpdate();
|
||||
}
|
||||
|
||||
private void updateTimeLinePositions() {
|
||||
|
|
Loading…
Add table
Reference in a new issue