LarryRuane
commented at 11:07 pm on August 20, 2019:
contributor
This PR was part of #16115 but reviewers requested that this be made into a separate PR. As explained in #16115, it’s useful, maybe even crucial, for support, analysis, and debugging purposes for the configuration arguments to be present in the debug.log file, as that may be the only artifact provided to the developer or support team. That PR logs the configuration settings (command-line arguments and bitcoin.conf contents) when bitcoind starts. But sometime later, the debug log file may be “rotated” (a new debug.log file started so it doesn’t grow unbounded in size) and this information would be lost unless the previous debug.log is preserved.
This PR re-logs the configuration information when the log rotates, ensuring that the current debug.log file contains this information. Reviewers had reservations about the previous approach (which you can see in #16115’s discussion thread), so this PR implements this functionality in a simpler and (I believe) much better way.
fanquake added the label
Utils/log/libs
on Aug 20, 2019
DrahtBot
commented at 3:01 am on August 21, 2019:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#25614 (Severity-based logging, step 2 by jonatack)
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.
DrahtBot added the label
Needs rebase
on Aug 21, 2019
LarryRuane force-pushed
on Aug 21, 2019
DrahtBot removed the label
Needs rebase
on Aug 21, 2019
LarryRuane force-pushed
on Aug 21, 2019
in
test/functional/test_framework/test_node.py:310
in
d252dfe814outdated
0def assert_debug_log(self, expected_msgs, unexpected_msgs, timeout=2):
1 if unexpected_msgs is None:
2 unexpected_msgs = []
FWIW I think we should use a linter to guard against this Python gotcha :-)
LarryRuane
commented at 3:48 am on August 26, 2019:
Great catch, I had no idea! I fixed this in #16115 (where it was introduced) and force-pushed rebased this PR onto that branch.
LarryRuane
commented at 8:27 pm on August 29, 2019:
@practicalswift, I don’t think this was an actual problem. I added a debug print and unexpected_msgs didn’t include previous values. I think it’s not broken because this function, assert_debug_log(), doesn’t modify the variable (it’s not mutable). Here’s an extremely simplified version of this function and some sample calls to it:
0def assert_debug_log(unexpected_msgs=[]):
1 print(unexpected_msgs)
2 for unexpected_msg in unexpected_msgs:
3 print(' ', unexpected_msg)
45assert_debug_log()
6assert_debug_log(["foo"])
7assert_debug_log(unexpected_msgs=["foo"])
8assert_debug_log("bar") # not actually called this way but just curious
9assert_debug_log()
The output:
0[]
1['foo']
2 foo
3['foo']
4 foo
5bar
6 b
7 a
8 r
9[]
What prompted me to investigate this further is that I wondered if any of our existing python code has this problem. I found just one instance, which is in wallet_importmulti.py:
DrahtBot added the label
Needs rebase
on Jan 29, 2020
LarryRuane force-pushed
on Jan 31, 2020
DrahtBot removed the label
Needs rebase
on Jan 31, 2020
LarryRuane force-pushed
on Feb 18, 2020
LarryRuane
commented at 5:32 pm on February 18, 2020:
contributor
Rebased onto latest master
DrahtBot added the label
Needs rebase
on May 28, 2020
LarryRuane force-pushed
on May 28, 2020
DrahtBot removed the label
Needs rebase
on May 28, 2020
LarryRuane force-pushed
on Jul 12, 2020
LarryRuane
commented at 0:45 am on July 13, 2020:
contributor
Force-pushed merge conflict fixes. I believe all reviewer comments have been addressed; no more work planned, this PR can be merged if desired.
monstrobishi referenced this in commit
dfb35e0a17
on Jul 30, 2020
ShengguangXiao referenced this in commit
f1b90146b1
on Aug 28, 2020
DrahtBot added the label
Needs rebase
on Feb 18, 2021
LarryRuane force-pushed
on Mar 3, 2021
jonatack
commented at 10:48 pm on March 3, 2021:
contributor
Concept ACK. I’m a fan of the original feature that logs the config options to the debug log.
DrahtBot removed the label
Needs rebase
on Mar 3, 2021
DrahtBot added the label
Needs rebase
on Apr 23, 2021
LarryRuane force-pushed
on Apr 24, 2021
LarryRuane
commented at 3:48 am on April 24, 2021:
contributor
Force-pushed required rebase. I should have mentioned earlier that you can test this manually by starting bitcoind, waiting for it to start up and sync, and then running:
0kill -SIGHUP `pgrep bitcoind`
Then check debug.log; the version information and configuration settings should appear at the end. (You can do that kill repeatedly, and the information will appear again each time.)
A more realistic test is is to do actual log rotation: Start bitcoind, wait for it to start up, then
0mv ~/.bitcoin/debug.log ~/.bitcoin/debug.log.old
(Note that in this state, additional logging will go to debug.log.old; the new debug.log won’t exist.)
Then send the signal. A new debug.log will be created containing the version and configuration information. Further logging will appear there (and not to debug.log.old). The intention is that debug.log.old can be compressed, or archived (or deleted) or whatever. (See man logrotate.)
DrahtBot removed the label
Needs rebase
on Apr 24, 2021
rebroad
commented at 4:46 pm on November 21, 2021:
contributor
NACK - does not seem useful or necessary (given the previous logs can be referred to easily).
LarryRuane
commented at 5:28 pm on November 21, 2021:
contributor
NACK - does not seem useful or necessary (given the previous logs can be referred to easily).
Well, if it’s not useful or necessary, I don’t think it’s for this reason, because an external log rotation agent (see logrotate on Unix-like systems, for example) may have deleted the initial part of the debug.log file for the currently-running instance of bitcoind that contains the configuration information (which does get logged at startup).
rebroad
commented at 1:13 pm on November 25, 2021:
contributor
NACK - does not seem useful or necessary (given the previous logs can be referred to easily).
Well, if it’s not useful or necessary, I don’t think it’s for this reason, because an external log rotation agent (see logrotate on Unix-like systems, for example) may have deleted the initial part of the debug.log file for the currently-running instance of bitcoind that contains the configuration information (which does get logged at startup).
ah, I see.. yes, in that case this might be useful, but I think it’s better if it’s optional - or you could just use a logrotate script to save this part of the debug.log file elsewhere before it deletes the file.
DrahtBot added the label
Needs rebase
on May 24, 2022
LarryRuane force-pushed
on Aug 2, 2022
LarryRuane
commented at 7:04 pm on August 2, 2022:
contributor
Force-pushed rebase, and made a few improvements.
DrahtBot removed the label
Needs rebase
on Aug 2, 2022
util: relog configuration arguments when debug.log rotatesa4e6c45238
LarryRuane force-pushed
on Aug 2, 2022
DrahtBot added the label
Needs rebase
on Sep 1, 2022
DrahtBot
commented at 9:18 pm on September 1, 2022:
contributor
🐙 This pull request conflicts with the target branch and needs rebase.
Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.
achow101
commented at 6:01 pm on October 12, 2022:
member
Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened.
achow101 closed this
on Oct 12, 2022
knst referenced this in commit
4d794e027c
on Feb 13, 2023
knst referenced this in commit
45d58d93ed
on Feb 13, 2023
knst referenced this in commit
16ad65a17c
on Feb 28, 2023
knst referenced this in commit
4507ba2728
on Feb 28, 2023
knst referenced this in commit
3c2ab6c42b
on Mar 14, 2023
knst referenced this in commit
1fad1541e8
on Mar 15, 2023
PastaPastaPasta referenced this in commit
a84ec5cc19
on Apr 4, 2023
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: 2024-11-17 06:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me