Improve logging

This commit is contained in:
Manfred Karrer 2019-01-03 14:00:39 +01:00
parent d57f6ad3d2
commit c63ecb1ec3
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
3 changed files with 6 additions and 2 deletions

View File

@ -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 // 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.) // to change now as it used in many areas.)
if (daoStateService.getBlockAtHeight(rawBlock.getHeight()).isPresent()) { 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(); return Optional.empty();
} }

View File

@ -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 // 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 // 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. // used at next startup.
long ts = System.currentTimeMillis();
for (RawBlock block : blockList) { for (RawBlock block : blockList) {
try { try {
doParseBlock(block); doParseBlock(block);
@ -154,6 +155,7 @@ public class LiteNode extends BsqNode {
break; break;
} }
} }
log.info("Parsing {} blocks took {} seconds.", blockList.size(), (System.currentTimeMillis() - ts) / 1000d);
onParseBlockChainComplete(); onParseBlockChainComplete();
} }

View File

@ -115,6 +115,8 @@ public class BlockParser {
genesisBlockHeight, genesisBlockHeight,
genesisTotalSupply) genesisTotalSupply)
.ifPresent(txList::add)); .ifPresent(txList::add));
if (System.currentTimeMillis() - startTs > 0)
log.info("parseBsqTxs took {} ms", rawBlock.getRawTxs().size(), System.currentTimeMillis() - startTs); log.info("parseBsqTxs took {} ms", rawBlock.getRawTxs().size(), System.currentTimeMillis() - startTs);
daoStateService.onParseBlockComplete(block); daoStateService.onParseBlockComplete(block);