Fix compatibility with `-debuglogfile` command-line option
What changed, and why it matters
This commit is a minor user-facing cleanup. It replaces hardcoded references to 'debug.log' with the actual custom log filename when a user has set one via the -debuglogfile option, and softens a few help/error strings to say 'debug log' instead of 'debug.log'. There is no security issue here.
No security action needed; treat as a normal bugfix/cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes the literal ‘debug.log’ string from initialization error messages, fatal abort messages, and RPC help text. It uses LogInstance().m_file_path.filename() so messages point users to the correct file when -debuglogfile is configured. Help strings for -shrinkdebugfile, verifychain, and importmempool are updated to refer generically to the ‘debug log’. No functional logging behavior, path handling, or privilege boundary changes.
Changed components
src/bitcoind.cppsrc/init/common.cppsrc/node/abort.cppsrc/rpc/blockchain.cppsrc/rpc/mempool.cppInspect captured patch +6 / −5
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 323e7577..32db3e72 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -224,7 +224,7 @@ static bool AppInit(NodeContext& node)
if (token) { // Success
exit(EXIT_SUCCESS);
} else { // fRet = false or token read error (premature exit).
- tfm::format(std::cerr, "Error during initialization - check debug.log for details\n");
+ tfm::format(std::cerr, "Error during initialization - check %s for details\n", fs::PathToString(LogInstance().m_file_path.filename()));
exit(EXIT_FAILURE);
}
}
diff --git a/src/init/common.cpp b/src/init/common.cpp
index cb35c1b4..f65e3c92 100644
--- a/src/init/common.cpp
+++ b/src/init/common.cpp
@@ -40,7 +40,7 @@ void AddLoggingArgs(ArgsManager& argsman)
argsman.AddArg("-loglevelalways", strprintf("Always prepend a category and level (default: %u)", DEFAULT_LOGLEVELALWAYS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-logratelimit", strprintf("Apply rate limiting to unconditional logging to mitigate disk-filling attacks (default: %u)", BCLog::DEFAULT_LOGRATELIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-printtoconsole", "Send trace/debug info to console (default: 1 when no -daemon. To disable logging to file, set -nodebuglogfile)", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
- argsman.AddArg("-shrinkdebugfile", "Shrink debug.log file on client startup (default: 1 when no -debug)", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
+ argsman.AddArg("-shrinkdebugfile", "Shrink debug log file on client startup (default: 1 when no -debug)", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
}
void SetLoggingOptions(const ArgsManager& args)
diff --git a/src/node/abort.cpp b/src/node/abort.cpp
index a7c81536..9483e56a 100644
--- a/src/node/abort.cpp
+++ b/src/node/abort.cpp
@@ -7,6 +7,7 @@
#include <logging.h>
#include <node/interface_ui.h>
#include <node/warnings.h>
+#include <util/fs.h>
#include <util/signalinterrupt.h>
#include <util/translation.h>
@@ -18,7 +19,7 @@ namespace node {
void AbortNode(const std::function<bool()>& shutdown_request, std::atomic<int>& exit_status, const bilingual_str& message, node::Warnings* warnings)
{
if (warnings) warnings->Set(Warning::FATAL_INTERNAL_ERROR, message);
- InitError(_("A fatal internal error occurred, see debug.log for details: ") + message);
+ InitError(strprintf(_("A fatal internal error occurred, see %s for details: %s"), fs::PathToString(LogInstance().m_file_path.filename()), message));
exit_status.store(EXIT_FAILURE);
if (shutdown_request && !shutdown_request()) {
LogError("Failed to send shutdown signal\n");
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index d97b7c6c..af744c47 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1270,7 +1270,7 @@ static RPCHelpMan verifychain()
{"nblocks", RPCArg::Type::NUM, RPCArg::DefaultHint{strprintf("%d, 0=all", DEFAULT_CHECKBLOCKS)}, "The number of blocks to check."},
},
RPCResult{
- RPCResult::Type::BOOL, "", "Verification finished successfully. If false, check debug.log for reason."},
+ RPCResult::Type::BOOL, "", "Verification finished successfully. If false, check debug log for reason."},
RPCExamples{
HelpExampleCli("verifychain", "")
+ HelpExampleRpc("verifychain", "")
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index c480b5af..5f137bbf 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -1142,7 +1142,7 @@ static RPCHelpMan importmempool()
};
if (!node::LoadMempool(mempool, load_path, chainstate, std::move(opts))) {
- throw JSONRPCError(RPC_MISC_ERROR, "Unable to import mempool file, see debug.log for details.");
+ throw JSONRPCError(RPC_MISC_ERROR, "Unable to import mempool file, see debug log for details.");
}
UniValue ret{UniValue::VOBJ};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.