From 6900964c03e823c740169d8198cdff2600453d06 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 14 Nov 2019 18:49:04 +0900 Subject: [PATCH] Fix debug log not showing (Fix #1157) --- .../Configuration/BTCPayServerOptions.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/BTCPayServer/Configuration/BTCPayServerOptions.cs b/BTCPayServer/Configuration/BTCPayServerOptions.cs index 438168473..47cfbc801 100644 --- a/BTCPayServer/Configuration/BTCPayServerOptions.cs +++ b/BTCPayServer/Configuration/BTCPayServerOptions.cs @@ -58,7 +58,16 @@ namespace BTCPayServer.Configuration public static string GetDebugLog(IConfiguration configuration) { - return configuration.GetValue("debuglog", null); + var logfile = configuration.GetValue("debuglog", null); + if (!string.IsNullOrEmpty(logfile)) + { + if (!Path.IsPathRooted(logfile)) + { + var networkType = DefaultConfiguration.GetNetworkType(configuration); + logfile = Path.Combine(configuration.GetDataDir(networkType), logfile); + } + } + return logfile; } public static LogEventLevel GetDebugLogLevel(IConfiguration configuration) { @@ -207,11 +216,6 @@ namespace BTCPayServer.Configuration LogFile = GetDebugLog(conf); if (!string.IsNullOrEmpty(LogFile)) - { - if (!Path.IsPathRooted(LogFile)) - LogFile = Path.Combine(DataDir, LogFile); - } - if (!string.IsNullOrEmpty(LogFile)) { Logs.Configuration.LogInformation("LogFile: " + LogFile); Logs.Configuration.LogInformation("Log Level: " + GetDebugLogLevel(conf));