diff --git a/build.ps1 b/build.ps1 index 1bfe5931..0d5e3516 100644 --- a/build.ps1 +++ b/build.ps1 @@ -26,12 +26,12 @@ if (-Not $LastExitCode -eq 0) { exit $LastExitCode } -msbuild /t:Pack .\src\NLog.Extensions.Logging\ /p:targetFrameworks='"net461;netstandard1.3;netstandard1.5;netstandard2.0;netcoreapp3.1;net5.0"' /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal /p:ContinuousIntegrationBuild=true +msbuild /t:Pack .\src\NLog.Extensions.Logging\ /p:targetFrameworks='"net461;netstandard1.3;netstandard1.5;netstandard2.0;netstandard2.1;net6.0"' /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal /p:ContinuousIntegrationBuild=true if (-Not $LastExitCode -eq 0) { exit $LastExitCode } -msbuild /t:Pack .\src\NLog.Extensions.Hosting\ /p:targetFrameworks='"netstandard2.0;netcoreapp3.1;net5.0"' /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal /p:ContinuousIntegrationBuild=true +msbuild /t:Pack .\src\NLog.Extensions.Hosting\ /p:targetFrameworks='"netstandard2.0;netstandard2.1;net6.0"' /p:VersionPrefix=$versionPrefix /p:VersionSuffix=$versionSuffix /p:FileVersion=$versionFile /p:ProductVersion=$versionProduct /p:Configuration=Release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:PackageOutputPath=..\..\artifacts /verbosity:minimal /p:ContinuousIntegrationBuild=true if (-Not $LastExitCode -eq 0) { exit $LastExitCode } diff --git a/src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj b/src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj index 7f2df0c3..9557ba5b 100644 --- a/src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj +++ b/src/NLog.Extensions.Hosting/NLog.Extensions.Hosting.csproj @@ -1,7 +1,7 @@  - netstandard2.0;netcoreapp3.1;net5.0 + netstandard2.0;netstandard2.1;net6.0 Full true true @@ -40,12 +40,12 @@ Full changelog: https://github.com/NLog/NLog.Extensions.Logging/blob/master/CHAN - + - - + + diff --git a/src/NLog.Extensions.Logging/Logging/ActivityExtensions.cs b/src/NLog.Extensions.Logging/Logging/ActivityExtensions.cs index eab2bbc6..f6351290 100644 --- a/src/NLog.Extensions.Logging/Logging/ActivityExtensions.cs +++ b/src/NLog.Extensions.Logging/Logging/ActivityExtensions.cs @@ -1,4 +1,4 @@ -#if NET5_0 +#if NET6_0 using System.Diagnostics; diff --git a/src/NLog.Extensions.Logging/Logging/NLogBeginScopeParser.cs b/src/NLog.Extensions.Logging/Logging/NLogBeginScopeParser.cs index 9c0feb2d..dea8500a 100644 --- a/src/NLog.Extensions.Logging/Logging/NLogBeginScopeParser.cs +++ b/src/NLog.Extensions.Logging/Logging/NLogBeginScopeParser.cs @@ -58,7 +58,7 @@ private IDisposable CaptureScopeProperties(IReadOnlyList> IncludeActivityIdsProperties(IReadOnlyList> scopePropertyList) { - return scopePropertyList; + return scopePropertyList; // Not supported } #else - private static IReadOnlyList> IncludeActivityIdsProperties(IReadOnlyList> scopePropertyList) + private IReadOnlyList> IncludeActivityIdsProperties(IReadOnlyList> scopePropertyList) { - if (scopePropertyList.Count > 1 && "RequestPath".Equals(scopePropertyList[1].Key)) + if (_options.IncludeActivityIdsWithBeginScope && "RequestId".Equals(scopePropertyList[0].Key)) { - var activty = System.Diagnostics.Activity.Current; - if (activty != null) - return new ScopePropertiesWithActivityIds(scopePropertyList, activty); + if (scopePropertyList.Count > 1 && "RequestPath".Equals(scopePropertyList[1].Key)) + { + var activty = System.Diagnostics.Activity.Current; + if (activty != null) + return new ScopePropertiesWithActivityIds(scopePropertyList, activty); + } } return scopePropertyList; diff --git a/src/NLog.Extensions.Logging/Logging/NLogProviderOptions.cs b/src/NLog.Extensions.Logging/Logging/NLogProviderOptions.cs index 5df31c4f..d233c77f 100644 --- a/src/NLog.Extensions.Logging/Logging/NLogProviderOptions.cs +++ b/src/NLog.Extensions.Logging/Logging/NLogProviderOptions.cs @@ -55,7 +55,7 @@ public class NLogProviderOptions /// public bool AutoShutdown { get; set; } -#if NET5_0 +#if NET6_0 /// /// Automatically include , and /// @@ -73,6 +73,7 @@ public class NLogProviderOptions /// /// Consider using ${activity} as alternative /// + [Obsolete("Only supported with NET6 (or newer)")] #endif public bool IncludeActivityIdsWithBeginScope { get; set; } diff --git a/src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj b/src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj index 07593000..e20cb6ea 100644 --- a/src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj +++ b/src/NLog.Extensions.Logging/NLog.Extensions.Logging.csproj @@ -1,6 +1,6 @@  - net461;netstandard1.3;netstandard1.5;netstandard2.0;netcoreapp3.1;net5.0 + net461;netstandard1.3;netstandard1.5;netstandard2.0;netstandard2.1;net6.0 Full true true @@ -57,12 +57,12 @@ List of major changes in NLog 5.0: https://nlog-project.org/2021/08/25/nlog-5-0- NLog.Extensions.Logging for .NET Standard 2.0 $(DefineConstants);NETSTANDARD - - NLog.Extensions.Logging for .NET Core 3.1 + + NLog.Extensions.Logging for .NET Standard 2.1 $(DefineConstants);NETSTANDARD - - NLog.Extensions.Logging for .NET 5.0 + + NLog.Extensions.Logging for .NET 6 $(DefineConstants);NETSTANDARD @@ -91,13 +91,13 @@ List of major changes in NLog 5.0: https://nlog-project.org/2021/08/25/nlog-5-0- - + - - - + + + diff --git a/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj b/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj index 66945c4c..760afeef 100644 --- a/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj +++ b/test/NLog.Extensions.Hosting.Tests/NLog.Extensions.Hosting.Tests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp3.1;net5.0 + net461;netcoreapp3.1;net6.0 Library false full @@ -22,7 +22,7 @@ - + diff --git a/test/NLog.Extensions.Logging.Tests/Extensions/ConfigureExtensionsTests.cs b/test/NLog.Extensions.Logging.Tests/Extensions/ConfigureExtensionsTests.cs index 75518965..6a3d569a 100644 --- a/test/NLog.Extensions.Logging.Tests/Extensions/ConfigureExtensionsTests.cs +++ b/test/NLog.Extensions.Logging.Tests/Extensions/ConfigureExtensionsTests.cs @@ -57,7 +57,7 @@ public void AddNLog_LoggerFactory_LogInfoWithEventId_ShouldLogToNLogWithEventId( AssertSingleMessage(memoryTarget, $"{expectedEventInLog} - test message with 1 arg"); } -#if NET5_0 +#if NET6_0 [Fact] public void AddNLog_LoggerFactory_IncludeActivityIdsWithBeginScope() { diff --git a/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj b/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj index 0de45566..ef6bf72f 100644 --- a/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj +++ b/test/NLog.Extensions.Logging.Tests/NLog.Extensions.Logging.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net461;net5.0 + netcoreapp3.1;net461;net6.0 Library false Full @@ -30,7 +30,7 @@ - +