From 25a11e10abf7d1fbbfea4382dc865f36134ae06d Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Mon, 23 Sep 2024 22:26:57 +0200 Subject: [PATCH] Version 5.3.14 (#1055) * UseNLog should fallback after checking ContentRoot for NLog.config * Version 5.3.14 --- CHANGELOG.MD | 6 ++++++ appveyor.yml | 2 +- build.ps1 | 2 +- src/NLog.Web.AspNetCore/AspNetExtensions.cs | 6 ++---- src/NLog.Web.AspNetCore/Config/SetupBuilderExtensions.cs | 3 +-- src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj | 4 ++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 5b380e2d..2403c734 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -4,6 +4,12 @@ See also [releases](https://github.com/NLog/NLog.Web/releases) and [milestones]( Date format: (year/month/day) +### Version 5.3.14 (2024/09/23) + +- **NLog.Web.AspNetCore** + - [#1055](https://github.com/NLog/NLog.Web/pull/1055) UseNLog should fallback after checking ContentRoot for NLog.config (#1055) (@snakefoot) + - [#1055](https://github.com/NLog/NLog.Web/pull/1055) Updated dependency NLog.Extensions.Logging v5.3.14 (#1055) (@snakefoot) + ### Version 5.3.13 (2024/09/12) - **NLog.Web.AspNetCore** diff --git a/appveyor.yml b/appveyor.yml index 1c3bb3ae..50f79877 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,7 @@ build_script: deploy: - provider: NuGet api_key: - secure: ACKSV1ixxNpO+2k8KvNDy6hd9QmR8lkQmKn773ZIIeVpG0ywYUhY4j8LcyykVR1a + secure: C4wzAE+AWne4TbR54gBDkLImCxsfIp21C16wi4LJ3bVSw/HqwZrMSYJ90kl6eAuf on: branch: master diff --git a/build.ps1 b/build.ps1 index 7c6d0627..445997f6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -2,7 +2,7 @@ # creates NuGet package at \artifacts dotnet --version -$versionPrefix = "5.3.13" # Also update version for minor versions in appveyor.yml +$versionPrefix = "5.3.14" # Also update version for minor versions in appveyor.yml $versionSuffix = "" $versionFile = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER} if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { diff --git a/src/NLog.Web.AspNetCore/AspNetExtensions.cs b/src/NLog.Web.AspNetCore/AspNetExtensions.cs index 73a03e4a..a4eb13d4 100644 --- a/src/NLog.Web.AspNetCore/AspNetExtensions.cs +++ b/src/NLog.Web.AspNetCore/AspNetExtensions.cs @@ -419,15 +419,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; } }); } diff --git a/src/NLog.Web.AspNetCore/Config/SetupBuilderExtensions.cs b/src/NLog.Web.AspNetCore/Config/SetupBuilderExtensions.cs index 169c830d..4b3b94a9 100644 --- a/src/NLog.Web.AspNetCore/Config/SetupBuilderExtensions.cs +++ b/src/NLog.Web.AspNetCore/Config/SetupBuilderExtensions.cs @@ -60,8 +60,7 @@ public static ISetupBuilder LoadConfigurationFromAppSettings(this ISetupBuilder { // Fallback when environment-specific NLog config could not load var nlogConfigFilePath = Path.Combine(basePath, "nlog.config"); - if (File.Exists(nlogConfigFilePath)) - config.Configuration = new XmlLoggingConfiguration(nlogConfigFilePath, config.LogFactory); + config.Configuration = File.Exists(nlogConfigFilePath) ? new XmlLoggingConfiguration(nlogConfigFilePath, config.LogFactory) : null; } }); } diff --git a/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj b/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj index 9e43f2e6..8915cffb 100644 --- a/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj +++ b/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj @@ -15,8 +15,8 @@ Integrates NLog as provider for Microsoft.Extensions.Logging, and provides NLog ChangeLog: -- AspNetRequestUrlRenderer - Mark Properties-option as DefaultParameter (#1053) (@snakefoot) -- Updated dependency NLog.Extensions.Logging v5.3.13 (#1054) (@snakefoot) +- UseNLog should fallback after checking ContentRoot for NLog.config (#1055) (@snakefoot) +- Updated dependency NLog.Extensions.Logging v5.3.14 (#1055) (@snakefoot) List of major changes in NLog 5.0: https://nlog-project.org/2022/05/16/nlog-5-0-finally-ready.html