Fix compatibility with -debuglogfile command-line option #33215

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:250819-debuglog changing 6 files +11 −6
  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. 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.
    af1b42befd
  3. DrahtBot commented at 11:00 am on August 19, 2025: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  4. hebasto marked this as a draft on Aug 19, 2025
  5. DrahtBot added the label CI failed on Aug 19, 2025
  6. bitcoin deleted a comment on Aug 19, 2025
  7. in src/bitcoind.cpp:222 in af1b42befd
    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:
    0                    tfm::format(std::cerr, "Error during initialization - check %s for details\n", fs::PathToString(LogInstance().m_file_path.filename()));
    
  8. in src/node/abort.cpp:22 in af1b42befd
    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:
    0    InitError(strprintf(_("A fatal internal error occurred, see %s for details: %s"), fs::PathToString(LogInstance().m_file_path.filename()), message));
    
  9. in src/rpc/blockchain.cpp:1231 in af1b42befd
    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:
    0                    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.

  10. in src/rpc/mempool.cpp:784 in af1b42befd
    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:
    0                throw JSONRPCError(RPC_MISC_ERROR, "Unable to import mempool file, see debug log for details.");
    
  11. luke-jr changes_requested

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: 2025-09-02 12:13 UTC

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