aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorJim Posen <jimpo@coinbase.com>2018-04-20 01:11:44 -0700
committerJim Posen <jimpo@coinbase.com>2018-04-29 14:37:19 -0700
commit8c2d695c4a45bdd9378c7970b0fcba6e1efc01f9 (patch)
tree43b04976c81df286c18c22e67d077bed78fcd087 /src/init.cpp
parent8e7b961388920144993d0bd56d93f89e5c60fbff (diff)
downloadbitcoin-8c2d695c4a45bdd9378c7970b0fcba6e1efc01f9.tar.xz
util: Store debug log file path in BCLog::Logger member.
This breaks the cyclic between logging and util.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 7bc2f63022..6423d87026 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -826,13 +826,15 @@ static std::string ResolveErrMsg(const char * const optname, const std::string&
*/
void InitLogging()
{
+ g_logger->m_print_to_file = !gArgs.IsArgNegated("-debuglogfile");
+ g_logger->m_file_path = AbsPathForConfigVal(gArgs.GetArg("-debuglogfile", DEFAULT_DEBUGLOGFILE));
+
// Add newlines to the logfile to distinguish this execution from the last
// one; called before console logging is set up, so this is only sent to
// debug.log.
LogPrintf("\n\n\n\n\n");
g_logger->m_print_to_console = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false));
- g_logger->m_print_to_file = !gArgs.IsArgNegated("-debuglogfile");
g_logger->m_log_timestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
g_logger->m_log_time_micros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
@@ -1233,7 +1235,7 @@ bool AppInitMain()
}
if (!g_logger->OpenDebugLog()) {
return InitError(strprintf("Could not open debug log file %s",
- g_logger->GetDebugLogPath().string()));
+ g_logger->m_file_path.string()));
}
}