Fix debug log not showing (Fix #1157)

This commit is contained in:
nicolas.dorier
2019-11-14 18:49:04 +09:00
parent 3d2b8d2969
commit 6900964c03

View File

@@ -58,7 +58,16 @@ namespace BTCPayServer.Configuration
public static string GetDebugLog(IConfiguration configuration)
{
return configuration.GetValue<string>("debuglog", null);
var logfile = configuration.GetValue<string>("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));