RPC/testing: logprint RPC command #15753

pull kallewoof wants to merge 2 commits into bitcoin:master from kallewoof:rpc-logprint changing 2 files +34 −0
  1. kallewoof commented at 3:55 AM on April 5, 2019: member

    I recently found this to be a useful addition when debugging something as I could easily pass info into the debug.log file for the given node, including things like expected outputs and such.

    • 6c9c087 adds logprint <message> RPC command
    • e0c0ce2 auto-logprints to all running nodes whenever self.log is logged to (this may be overkill)

    If the latter seems contentious, I can pull it out for now.

  2. rpc: add logprint RPC command 6c9c087f98
  3. fanquake added the label RPC/REST/ZMQ on Apr 5, 2019
  4. DrahtBot commented at 4:24 AM on April 5, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #15382 ([util] add runCommandParseJSON by Sjors)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. test: auto-logprint logger messages to RPC logs of all running nodes e0c0ce2ef4
  6. kallewoof force-pushed on Apr 5, 2019
  7. practicalswift commented at 12:31 PM on April 5, 2019: contributor

    Concept ACK -- seems useful.

    Regarding the implementation:

    This opens up for log injection since the string is not passed via SanitizeString(…) before being printed/written to disk. This means that newlines, escape characters etc can be written freely.

    But perhaps we trust our RPC clients to not perform such malicious actions?

    Also: a test could be added checking that a RPC call logprint results in the expected log output?

  8. MarcoFalke commented at 1:11 PM on April 5, 2019: member

    How is this different from ./test/functional/combine_logs.py?

  9. promag commented at 2:47 PM on April 5, 2019: member

    I recently found this to be a useful addition when debugging something

    Could you be more specific, like give a concrete use case?

  10. kallewoof commented at 12:34 AM on April 8, 2019: member

    @practicalswift Thanks for feedback. I will look into using SanitizeString. @MarcoFalke It is different in that you do not need to combine the logs. You can look at a specific node's debug.log output and see logprint's from the tests directly. @promag The output from all combined logs is rather large, so having a way to see test debug log in individual node log files was convenient.

    From reactions I am starting to think maybe this is not what people want, so I will close this PR unless it gets more hearts.

  11. MarcoFalke commented at 3:21 PM on April 8, 2019: member

    Adding an RPC to bitcoind for a change that can be realized with test-only helper scripts seems overkill. What about modifying combine_logs.py to optionally only combine the logs for a single node, as opposed to all nodes? I am trying to understand the use case that is not covered by combine_logs.py...

  12. kallewoof commented at 11:13 PM on April 8, 2019: member

    @MarcoFalke I like the idea of modifying combine_logs to only combine a single node log. I think that would solve it on my end.

  13. kallewoof closed this on Apr 8, 2019

  14. kallewoof deleted the branch on Apr 8, 2019
  15. DrahtBot locked this on Dec 16, 2021

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-04-13 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me