Skip to content

Commit

Permalink
UseNLog should fallback after checking ContentRoot for NLog.config
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot committed Sep 23, 2024
1 parent 9106fa3 commit 87eb255
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/NLog.Extensions.Hosting/Extensions/ConfigureExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ 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
{
var nlogConfig = LoadXmlLoggingConfigurationFromPath(contentRootPath, "NLog.config", config.LogFactory) ??
LoadXmlLoggingConfigurationFromPath(contentRootPath, "nlog.config", config.LogFactory);
if (nlogConfig != null)
config.Configuration = nlogConfig;
else
config.Configuration = config.LogFactory.Configuration;
}
});
}
Expand Down

0 comments on commit 87eb255

Please sign in to comment.