Logging

刪除嘈雜的日誌消息,例如 AcceptBlockHeader

  • September 2, 2020

有沒有辦法抑制輸出這些日誌?

2019-11-07T00:32:02Z ERROR: AcceptBlockHeader: prev block not found
2019-11-07T01:02:36Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000000000014219120d5167a4281437fc379129d4ba6f6e956ca1db77f5fa, bad-diffbits, incorrect proof of work
2019-11-07T01:08:55Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000004bfb561102f5f04d4bab0cc70a403da70b82ce33657e10ed46b9000f, bad-diffbits, incorrect proof of work
2019-11-07T04:16:24Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000000000001daed8bac77bdf571441649e51732e91bec984cf97a39005a1, bad-diffbits, incorrect proof of work
2019-11-07T04:22:01Z ERROR: AcceptBlockHeader: Consensus::CheckBlockHeader: 0fd7ab36246daf61802e10a0316cc2b0f17a1d6404bfdd53878ba34e158b4680, high-hash, proof of work failed
2019-11-07T10:12:22Z ERROR: AcceptBlockHeader: Consensus::CheckBlockHeader: 0fd7ab36246daf61802e10a0316cc2b0f17a1d6404bfdd53878ba34e158b4680, high-hash, proof of work failed
2019-11-07T23:10:53Z ERROR: AcceptBlockHeader: prev block not found

它們有點吵,我想把它們從我的日誌中刪除。

看到2019年有一個issue,但是好像沒有追到: https ://github.com/bitcoin/bitcoin/issues/17421

根據我的理解,ERROR: AcceptBlockHeader: Consensus::CheckBlockHeader:可以使用 https://github.com/bitcoin/bitcoin/pull/10123/ 從日誌文件中排除-debug提及-debugexclude,因為它在https://github.com/中被分配了一個“驗證”類別比特幣/比特幣/blob/48c1083632687a42ac603d4f241e70616a1d3815/src/validation.cpp#L3643

日誌中保存的其他錯誤消息未分配任何類別LogPrintf而是LogPrinthttps://github.com/bitcoin/bitcoin/blob/48c1083632687a42ac603d4f241e70616a1d3815/src/validation.cpp#L3622中使用

引用自:https://bitcoin.stackexchange.com/questions/98820