mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-08 06:37:50 +02:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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", "")
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user