Repository navigation
Conversation
Exercise a daemon startup failure and a fatal index error with -nodebuglogfile, which currently leaves an empty filename in both messages.
When file logging is disabled, direct daemon users to the foreground startup error and omit the log hint from fatal errors, which already include the cause.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
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. |
| exit(EXIT_SUCCESS); | ||
| } else { // fRet = false or token read error (premature exit). | ||
| tfm::format(std::cerr, "Error during initialization - check %s for details\n", fs::PathToString(LogInstance().m_file_path.filename())); | ||
| const auto hint{LogInstance().m_print_to_file ? strprintf("check %s", fs::PathToString(LogInstance().m_file_path.filename())) : "run in the foreground"}; |
There was a problem hiding this comment.
With file logging on, the new test's PID failure says check debug.log for details, but the child fails before StartLogging, so the error never reaches the log file, with or without this PR.
| const auto hint{LogInstance().m_print_to_file ? strprintf("check %s", fs::PathToString(LogInstance().m_file_path.filename())) : "run in the foreground"}; | |
| const auto hint{LogInstance().m_print_to_file ? strprintf("check %s or run in the foreground", fs::PathToString(LogInstance().m_file_path.filename())) : "run in the foreground"}; |

Problem: When startup fails under
-daemonwait, the daemon points to the debug log for details.With
-nodebuglogfile, that hint readscheck for details, and fatal errors also include an empty log reference before the cause.Fix: When file logging is disabled, suggest running in the foreground for startup details and report the fatal error directly.
Reproduce the daemon message on Unix
build/bin/bitcoind -regtest -datadir="$(mktemp -d)" -daemonwait -nodebuglogfile -pid=missing/bitcoind.pidWith the fix, this prints
Error during initialization - run in the foreground for details.Without
-daemonwait, the error names the PID file the node couldn't create.