mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-22 20:58:09 +02:00
Merge #16115: On bitcoind startup, write config args to debug.log
b951b0973con startup, write config options to debug.log (Larry Ruane) Pull request description: When a developer is examining `debug.log` after something goes wrong, it's often useful to know the exact options the failing instance of `bitcoind` was started with. Sometimes the `debug.log` file is all that's available for the analysis. This PR logs the `bitcoin.conf` entries and command-line arguments to `debug.log` on startup. ACKs for top commit: MarcoFalke: ACKb951b0973c🐪 jonatack: ACKb951b0973creviewed diff, re-code review, built, ran tests, launched bitcoind and reviewed debug log output, verified value of `str` debug log in the added unit test. Tree-SHA512: bbca4fb3d49f99261758302bde0b8b67300ccc72e7380b01f1f66a146ae8a008a045df0ca5ca9664caff034d0ee38ea7ef38a50f38374525608c07ba52790358
This commit is contained in:
@@ -298,7 +298,9 @@ class TestNode():
|
||||
wait_until(self.is_node_stopped, timeout=timeout)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def assert_debug_log(self, expected_msgs, timeout=2):
|
||||
def assert_debug_log(self, expected_msgs, unexpected_msgs=None, timeout=2):
|
||||
if unexpected_msgs is None:
|
||||
unexpected_msgs = []
|
||||
time_end = time.time() + timeout
|
||||
debug_log = os.path.join(self.datadir, self.chain, 'debug.log')
|
||||
with open(debug_log, encoding='utf-8') as dl:
|
||||
@@ -313,6 +315,9 @@ class TestNode():
|
||||
dl.seek(prev_size)
|
||||
log = dl.read()
|
||||
print_log = " - " + "\n - ".join(log.splitlines())
|
||||
for unexpected_msg in unexpected_msgs:
|
||||
if re.search(re.escape(unexpected_msg), log, flags=re.MULTILINE):
|
||||
self._raise_assertion_error('Unexpected message "{}" partially matches log:\n\n{}\n\n'.format(unexpected_msg, print_log))
|
||||
for expected_msg in expected_msgs:
|
||||
if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None:
|
||||
found = False
|
||||
|
||||
Reference in New Issue
Block a user