From f4520e27521cd0a70081929ee6d05a59a8886d93 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sun, 9 May 2021 09:00:53 +0100 Subject: [PATCH] Skip Block.logDebugInfo() altogether if the log level is more specific than DEBUG, to avoid wasting resources. --- src/main/java/org/qortal/block/Block.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/qortal/block/Block.java b/src/main/java/org/qortal/block/Block.java index 25959e1f..e2a15911 100644 --- a/src/main/java/org/qortal/block/Block.java +++ b/src/main/java/org/qortal/block/Block.java @@ -1998,6 +1998,10 @@ public class Block { private void logDebugInfo() { try { + // Avoid calculations if possible. We have to check against INFO here, since Level.isMoreSpecificThan() confusingly uses <= rather than just < + if (LOGGER.getLevel().isMoreSpecificThan(Level.INFO)) + return; + if (this.repository == null || this.getMinter() == null || this.getBlockData() == null) return;