RFC on logging improvements #20576

issue jonatack opened this issue on December 5, 2020
  1. jonatack commented at 11:12 AM on December 5, 2020: contributor

    Perhaps we can consider creating different levels of net logging.

    For instance, we could separate lower-frequency, important peer-level events (netpeers) from very high-frequency message-level passing (netmessages).

    Categories and naming suggestions welcome.

    One further suggestion by @jnewbery was:

    No objections. I'd take it ever further though, and add an (optional) logging severity (DEBUG/INFO/WARNING/ERROR or similar) that can be added to all log messages. The user can then either choose what severity logs they want for each category (eg = -debug=net:warning,tor:debug etc), or have a logging post-processor that can filter by severity/category.

    I like the idea of optional logging levels (debug/info/warning/error) for each category, including the default debug log, but agreement on which events go into which level may be difficult to achieve.

    To begin with, I propose separating the net logging into at least two categories. Thoughts? Implementation suggestions?

  2. jonatack added the label Feature on Dec 5, 2020
  3. jonatack renamed this:
    Separate `NET` logging into high-level and low-level categories `
    Separate `NET` logging into high-level and low-level categories
    on Dec 5, 2020
  4. fanquake added the label Utils/log/libs on Dec 5, 2020
  5. practicalswift commented at 4:44 PM on December 5, 2020: contributor

    Concept ACK: this would allow us to be more strict about not doing any unconditional logging for network events that are trivially triggerable by an attacker. (Context: One argument against making such logging conditional instead is that NET is currently too noisy.)

  6. jonatack closed this on Dec 7, 2020

  7. jonatack reopened this on Jan 12, 2021

  8. jonatack commented at 4:08 PM on January 12, 2021: contributor

    I've re-opened this in the hope that it may see Concept ACKs or that someone might implement it.

  9. jonatack cross-referenced this on Jan 14, 2021 from issue net: Log to net debug in MaybeDiscourageAndDisconnect except for noban and manual peers by MarcoFalke
  10. ghost commented at 7:56 PM on February 1, 2021: none

    +1 I wanted to log onion connections. Looks like net category does this. But that logs also all transactions etc. really noisy.

  11. jonatack cross-referenced this on Feb 15, 2021 from issue p2p: if no anchors.dat file, log a message instead of an error by jonatack
  12. jonatack commented at 12:38 PM on February 15, 2021: contributor

    Linking here to some ideas elsewhere on this topic:

    Maybe it would help to simply remove the screaming ERROR in all uppercase.

    Yes screaming is generally bad but apart from that I think it makes sense to have multiple severities in logging. E.g. other types of error that happen in DeserializeFileDB (say, specific de-serialization errors) might not be fatal but would ideally trigger someone to take a closer look. Something @gmaxwell suggested once is to replace it with UNEXPECTED. c-lightning does this as well.

    I think we should be consistent in the way this [the logging] is treated. Someone will create a pull in x months to fix this for banlist.dat, then for peers.dat in y months. So finally we have 5 different error messages for the same condition.

    • Failed to read fee estimates from {}. Continue anyway.
    • Failed to open mempool file from disk. Continuing anyway.
    • Could not find anchors file {}
    • Could not find asmap file {}
    • ... Another message for banlist and peers?
  13. jonatack renamed this:
    Separate `NET` logging into high-level and low-level categories
    RFC on logging improvements
    on Feb 15, 2021
  14. ghost commented at 1:03 PM on February 15, 2021: none

    See also #21102.

  15. laanwj added the label good first issue on Feb 15, 2021
  16. sidd4u commented at 2:35 PM on March 8, 2021: none

    hi, as a new contributor to open source, can I get opportunity to work on this request.

  17. jonatack commented at 4:04 PM on March 8, 2021: contributor

    Hi @sidd4u, no need to ask; feel free to propose your solution via a pull request. Thanks!

  18. jonatack cross-referenced this on May 21, 2021 from issue Discussion: Potential USDTs (User Static Defined Traces) for Core by 0xB10C
  19. bitcoin deleted a comment on Jun 14, 2021
  20. AditiThirdEye commented at 4:25 PM on August 18, 2021: none

    Can you please assign this issue to me if PR is not done yet.

  21. jonatack commented at 8:44 PM on August 18, 2021: contributor

    Hi @AditiThirdEye, thanks! No need to ask; feel free to open a pull request after becoming acquainted with the guidelines in CONTRIBUTING.md and doc/developer-notes.md 👍

  22. aswin6197 commented at 5:19 AM on October 24, 2021: none

    Hi @jonatack did you something like have a new enum with two values that's passed to the logPrint similar to LogFlags and added to logs, so it's easier to filter out important messages?

  23. anshu-khare-design cross-referenced this on Feb 3, 2022 from issue p2p: Split network logging into two categories by anshu-khare-design
  24. anshu-khare-design cross-referenced this on Feb 5, 2022 from issue p2p: Split network logging into two categories #24247 by anshu-khare-design
  25. klementtan cross-referenced this on Mar 2, 2022 from issue logging: Add severity level to logs by klementtan
  26. klementtan commented at 7:13 AM on March 3, 2022: contributor

    @jonatack @jnewbery I took a stab at this in #24464 and I tried to add log serverity levels (ie [net:warning]) in the logs. I plan to extend this further (in a separate PR) to allow users to specify the minimum level of logs. Would love to get your feedback on it 😄

  27. laanwj referenced this in commit 90e49c1ece on May 24, 2022
  28. jonatack referenced this in commit 73d430d2b9 on May 24, 2022
  29. sidhujag referenced this in commit 2f111e0cd8 on May 28, 2022
  30. jonatack commented at 7:21 PM on May 31, 2022: contributor

    Closing this as completed by #24464 and current follow-ups.

  31. jonatack closed this on May 31, 2022

  32. jonatack cross-referenced this on Jul 9, 2022 from issue Severity-based logging -- parent PR by jonatack
  33. bitcoin locked this on May 31, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:53 UTC