diff --git a/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs b/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs index 002bf02e..07d3126b 100644 --- a/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs +++ b/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs @@ -76,15 +76,13 @@ private static void TryLoadConfigurationFromContentRootPath(LogFactory logFactor LoadXmlLoggingConfigurationFromPath(contentRootPath, $"nlog.{environmentName}.config", config.LogFactory) ?? LoadXmlLoggingConfigurationFromPath(contentRootPath, "NLog.config", config.LogFactory) ?? LoadXmlLoggingConfigurationFromPath(contentRootPath, "nlog.config", config.LogFactory); - if (nlogConfig != null) - config.Configuration = nlogConfig; + config.Configuration = nlogConfig; } else { var nlogConfig = LoadXmlLoggingConfigurationFromPath(contentRootPath, "NLog.config", config.LogFactory) ?? LoadXmlLoggingConfigurationFromPath(contentRootPath, "nlog.config", config.LogFactory); - if (nlogConfig != null) - config.Configuration = nlogConfig; + config.Configuration = nlogConfig; } }); }