Fix compatibility with `-debuglogfile` command-line option #33215

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:250819-debuglog changing 5 files +6 −5
  1. hebasto commented at 10:59 AM on August 19, 2025: member

    This PR avoids hardcoding the "debug.log" filename, ensuring compatibility with custom filenames provided via the -debuglogfile command-line option.

  2. DrahtBot commented at 11:00 AM on August 19, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33215.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sedited, maflcko, achow101

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34806 (refactor: logging: Various API improvements by ajtowns)
    • #34038 (logging: replace -loglevel with -trace, expose trace logging via RPC by ajtowns)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. hebasto marked this as a draft on Aug 19, 2025
  4. DrahtBot added the label CI failed on Aug 19, 2025
  5. bitcoin deleted a comment on Aug 19, 2025
  6. in src/bitcoind.cpp:222 in af1b42befd outdated
     218 | @@ -219,7 +219,7 @@ static bool AppInit(NodeContext& node)
     219 |                  if (token) { // Success
     220 |                      exit(EXIT_SUCCESS);
     221 |                  } else { // fRet = false or token read error (premature exit).
     222 | -                    tfm::format(std::cerr, "Error during initialization - check debug.log for details\n");
     223 | +                    tfm::format(std::cerr, "Error during initialization - check %s for details\n", fs::PathToString(LogInstance().m_file_path));
    


    luke-jr commented at 4:30 PM on August 20, 2025:
                        tfm::format(std::cerr, "Error during initialization - check %s for details\n", fs::PathToString(LogInstance().m_file_path.filename()));
    

    hebasto commented at 8:23 PM on September 6, 2025:

    Thanks! Fixed.

  7. in src/node/abort.cpp:22 in af1b42befd outdated
      18 | @@ -18,7 +19,7 @@ namespace node {
      19 |  void AbortNode(const std::function<bool()>& shutdown_request, std::atomic<int>& exit_status, const bilingual_str& message, node::Warnings* warnings)
      20 |  {
      21 |      if (warnings) warnings->Set(Warning::FATAL_INTERNAL_ERROR, message);
      22 | -    InitError(_("A fatal internal error occurred, see debug.log for details: ") + message);
      23 | +    InitError(strprintf(_("A fatal internal error occurred, see %s for details: %s"), fs::PathToString(LogInstance().m_file_path), message));
    


    luke-jr commented at 4:31 PM on August 20, 2025:
        InitError(strprintf(_("A fatal internal error occurred, see %s for details: %s"), fs::PathToString(LogInstance().m_file_path.filename()), message));
    

    hebasto commented at 8:23 PM on September 6, 2025:

    Thanks! Fixed.

  8. in src/rpc/blockchain.cpp:1231 in af1b42befd outdated
    1227 | @@ -1226,7 +1228,7 @@ static RPCHelpMan verifychain()
    1228 |                      {"nblocks", RPCArg::Type::NUM, RPCArg::DefaultHint{strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS)}, "The number of blocks to check."},
    1229 |                  },
    1230 |                  RPCResult{
    1231 | -                    RPCResult::Type::BOOL, "", "Verification finished successfully. If false, check debug.log for reason."},
    1232 | +                    RPCResult::Type::BOOL, "", strprintf("Verification finished successfully. If false, check %s for reason.", fs::PathToString(LogInstance().m_file_path))},
    


    luke-jr commented at 4:38 PM on August 20, 2025:
                        RPCResult::Type::BOOL, "", "Verification finished successfully. If false, check debug log for reason."},
    

    I don't think it makes sense to include the real filename in RPC results.


    maflcko commented at 11:54 AM on September 26, 2025:

    Yeah, this is the RPC doc, not the RPC result. No opinion about the result, but it must not be in the doc. Otherwise, the doc is confusing, brittle and highly mutable.

  9. in src/rpc/mempool.cpp:784 in af1b42befd outdated
     780 | @@ -779,7 +781,7 @@ static RPCHelpMan importmempool()
     781 |              };
     782 |  
     783 |              if (!node::LoadMempool(mempool, load_path, chainstate, std::move(opts))) {
     784 | -                throw JSONRPCError(RPC_MISC_ERROR, "Unable to import mempool file, see debug.log for details.");
     785 | +                throw JSONRPCError(RPC_MISC_ERROR, strprintf("Unable to import mempool file, see %s for details.", fs::PathToString(LogInstance().m_file_path)));
    


    luke-jr commented at 4:39 PM on August 20, 2025:
                    throw JSONRPCError(RPC_MISC_ERROR, "Unable to import mempool file, see debug log for details.");
    
  10. luke-jr changes_requested
  11. luke-jr referenced this in commit b8c41a468d on Aug 20, 2025
  12. hebasto force-pushed on Sep 5, 2025
  13. maflcko removed the label CI failed on Sep 26, 2025
  14. fanquake commented at 2:11 PM on March 3, 2026: member

    Are you still working on this? Looks like there are outstanding review comments?

  15. Fix compatibility with `-debuglogfile` command-line option
    This change avoids hardcoding the "debug.log" filename, ensuring
    compatibility with custom filenames provided via the `-debuglogfile`
    command-line option.
    ddf2a064de
  16. hebasto force-pushed on Mar 10, 2026
  17. hebasto marked this as ready for review on Mar 10, 2026
  18. hebasto commented at 12:57 PM on March 10, 2026: member

    Are you still working on this? Looks like there are outstanding review comments?

    The feedback has been addressed.

    Rebased and undrafted.

  19. sedited approved
  20. sedited commented at 10:58 AM on March 13, 2026: contributor

    ACK ddf2a064deb2df91f92c8aefa44437303165169c

  21. maflcko commented at 1:32 PM on March 13, 2026: member

    review ACK ddf2a064deb2df91f92c8aefa44437303165169c 🐪

    <details><summary>Show signature</summary>

    Signature:

    untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    trusted comment: review ACK ddf2a064deb2df91f92c8aefa44437303165169c 🐪
    gmyCKDtYRW5Z/XoBtlYCmnEVDS6Vjx6bcxjB3Kks2GhKlPlm4OAJ+72pXswv60cSflClzpr2T95pxKKQUfPxCw==
    

    </details>

  22. achow101 commented at 11:35 PM on March 19, 2026: member

    ACK ddf2a064deb2df91f92c8aefa44437303165169c

  23. achow101 merged this on Mar 19, 2026
  24. achow101 closed this on Mar 19, 2026

  25. hebasto deleted the branch on Mar 20, 2026

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-24 21:12 UTC

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