From 87eb255b558132a450714466ca6bf976a44f604f Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Mon, 23 Sep 2024 21:14:17 +0200 Subject: [PATCH] UseNLog should fallback after checking ContentRoot for NLog.config --- src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs b/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs index 002bf02e..752fda0d 100644 --- a/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs +++ b/src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs @@ -78,6 +78,8 @@ private static void TryLoadConfigurationFromContentRootPath(LogFactory logFactor LoadXmlLoggingConfigurationFromPath(contentRootPath, "nlog.config", config.LogFactory); if (nlogConfig != null) config.Configuration = nlogConfig; + else + config.Configuration = config.LogFactory.Configuration; } else { @@ -85,6 +87,8 @@ private static void TryLoadConfigurationFromContentRootPath(LogFactory logFactor LoadXmlLoggingConfigurationFromPath(contentRootPath, "nlog.config", config.LogFactory); if (nlogConfig != null) config.Configuration = nlogConfig; + else + config.Configuration = config.LogFactory.Configuration; } }); }