From c63ecb1ec3cda8513b4e0faad5f80cd06cb7c37d Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Thu, 3 Jan 2019 14:00:39 +0100 Subject: [PATCH] Improve logging --- core/src/main/java/bisq/core/dao/node/BsqNode.java | 2 +- core/src/main/java/bisq/core/dao/node/lite/LiteNode.java | 2 ++ core/src/main/java/bisq/core/dao/node/parser/BlockParser.java | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/bisq/core/dao/node/BsqNode.java b/core/src/main/java/bisq/core/dao/node/BsqNode.java index 7bdeb6055d..b52df186cf 100644 --- a/core/src/main/java/bisq/core/dao/node/BsqNode.java +++ b/core/src/main/java/bisq/core/dao/node/BsqNode.java @@ -207,7 +207,7 @@ public abstract class BsqNode implements DaoSetupService { // height we have no block but chainHeight is initially set to genesis height (bad design ;-( but a bit tricky // to change now as it used in many areas.) if (daoStateService.getBlockAtHeight(rawBlock.getHeight()).isPresent()) { - log.info("We have already a block with the height of the new block. Height of new block={}", rawBlock.getHeight()); + log.debug("We have already a block with the height of the new block. Height of new block={}", rawBlock.getHeight()); return Optional.empty(); } diff --git a/core/src/main/java/bisq/core/dao/node/lite/LiteNode.java b/core/src/main/java/bisq/core/dao/node/lite/LiteNode.java index ef3f18aadf..66e221edb2 100644 --- a/core/src/main/java/bisq/core/dao/node/lite/LiteNode.java +++ b/core/src/main/java/bisq/core/dao/node/lite/LiteNode.java @@ -146,6 +146,7 @@ public class LiteNode extends BsqNode { // 144 blocks a day would result in about 4000 in a month, so if a user downloads the app after 1 months latest // release it will be a bit of a performance hit. It is a one time event as the snapshots gets created and be // used at next startup. + long ts = System.currentTimeMillis(); for (RawBlock block : blockList) { try { doParseBlock(block); @@ -154,6 +155,7 @@ public class LiteNode extends BsqNode { break; } } + log.info("Parsing {} blocks took {} seconds.", blockList.size(), (System.currentTimeMillis() - ts) / 1000d); onParseBlockChainComplete(); } diff --git a/core/src/main/java/bisq/core/dao/node/parser/BlockParser.java b/core/src/main/java/bisq/core/dao/node/parser/BlockParser.java index 5d71fd9164..d22a15d095 100644 --- a/core/src/main/java/bisq/core/dao/node/parser/BlockParser.java +++ b/core/src/main/java/bisq/core/dao/node/parser/BlockParser.java @@ -115,7 +115,9 @@ public class BlockParser { genesisBlockHeight, genesisTotalSupply) .ifPresent(txList::add)); - log.info("parseBsqTxs took {} ms", rawBlock.getRawTxs().size(), System.currentTimeMillis() - startTs); + + if (System.currentTimeMillis() - startTs > 0) + log.info("parseBsqTxs took {} ms", rawBlock.getRawTxs().size(), System.currentTimeMillis() - startTs); daoStateService.onParseBlockComplete(block); return block;