From a2e7e8841672a49a5d1c4b96754e07c7d75625c9 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 13 Jun 2019 23:38:39 +0200 Subject: [PATCH 01/14] Renamed RequestAccessor to HttpContextExtensions --- .../{RequestAccessorExtension.cs => HttpContextExtensions.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/Shared/Internal/{RequestAccessorExtension.cs => HttpContextExtensions.cs} (96%) diff --git a/src/Shared/Internal/RequestAccessorExtension.cs b/src/Shared/Internal/HttpContextExtensions.cs similarity index 96% rename from src/Shared/Internal/RequestAccessorExtension.cs rename to src/Shared/Internal/HttpContextExtensions.cs index 24d95e39..5747faa4 100644 --- a/src/Shared/Internal/RequestAccessorExtension.cs +++ b/src/Shared/Internal/HttpContextExtensions.cs @@ -10,7 +10,7 @@ namespace NLog.Web.Internal { - internal static class RequestAccessor + internal static class HttpContextExtensions { #if !ASP_NET_CORE internal static HttpRequestBase TryGetRequest(this HttpContextBase context) From 42e61f6666a8f3121a551f9096746f99c0a48e49 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 13 Jun 2019 23:39:02 +0200 Subject: [PATCH 02/14] aspnet-session - Reduce log-level to debug when session is not available --- src/Shared/Internal/HttpContextExtensions.cs | 43 ++++++++++++++++--- .../AspNetSessionIdLayoutRenderer.cs | 12 +++--- .../AspNetSessionValueLayoutRenderer.cs | 27 +++--------- 3 files changed, 47 insertions(+), 35 deletions(-) diff --git a/src/Shared/Internal/HttpContextExtensions.cs b/src/Shared/Internal/HttpContextExtensions.cs index 5747faa4..f7b7a8d0 100644 --- a/src/Shared/Internal/HttpContextExtensions.cs +++ b/src/Shared/Internal/HttpContextExtensions.cs @@ -1,12 +1,11 @@ using System; -using System.Text; #if !ASP_NET_CORE using System.Web; -using NLog.Common; #else +using System.Text; using Microsoft.AspNetCore.Http; - #endif +using NLog.Common; namespace NLog.Web.Internal { @@ -17,18 +16,24 @@ internal static HttpRequestBase TryGetRequest(this HttpContextBase context) { try { - return context.Request; + var request = context?.Request; + if (request == null) + InternalLogger.Debug("HttpContext Request Lookup returned null"); + return request; } catch (HttpException ex) { - InternalLogger.Debug(ex, "Exception thrown when accessing Request: " + ex.Message); + InternalLogger.Debug(ex, "HttpContext Request Lookup failed."); return null; } } #else internal static HttpRequest TryGetRequest(this HttpContext context) { - return context.Request; + var request = context?.Request; + if (request == null) + InternalLogger.Debug("HttpContext Request Lookup returned null"); + return request; } #endif @@ -53,5 +58,31 @@ internal static string GetString(this ISession session, string key) return Encoding.UTF8.GetString(data); } #endif + +#if !ASP_NET_CORE + internal static HttpSessionStateBase TryGetSession(this HttpContextBase context) + { + var session = context?.Session; + if (session == null) + InternalLogger.Debug("HttpContext Session Lookup returned null"); + return session; + } +#else + internal static ISession TryGetSession(this HttpContext context) + { + try + { + var session = context?.Session; + if (session == null) + InternalLogger.Debug("HttpContext Session Lookup returned null"); + return session; + } + catch (InvalidOperationException ex) + { + InternalLogger.Debug(ex, "HttpContext Session Lookup failed."); + return null; // System.InvalidOperationException: Session has not been configured for this application or request. + } + } +#endif } } \ No newline at end of file diff --git a/src/Shared/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs b/src/Shared/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs index 1e24a876..69f386ab 100644 --- a/src/Shared/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs +++ b/src/Shared/LayoutRenderers/AspNetSessionIdLayoutRenderer.cs @@ -1,7 +1,7 @@ using System.Text; -using NLog.Common; using NLog.Config; using NLog.LayoutRenderers; +using NLog.Web.Internal; #if !ASP_NET_CORE using System.Web; @@ -24,16 +24,14 @@ public class AspNetSessionIdLayoutRenderer : AspNetLayoutRendererBase protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) { var context = HttpContextAccessor.HttpContext; - if (context?.Session == null) - { - InternalLogger.Debug("aspnet-sessionid - HttpContext Session is null"); + var contextSession = context.TryGetSession(); + if (contextSession == null) return; - } #if !ASP_NET_CORE - builder.Append(context.Session.SessionID); + builder.Append(contextSession.SessionID); #else - builder.Append(context.Session.Id); + builder.Append(contextSession.Id); #endif } } diff --git a/src/Shared/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs b/src/Shared/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs index 052f58c2..e89a9b0c 100644 --- a/src/Shared/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs +++ b/src/Shared/LayoutRenderers/AspNetSessionValueLayoutRenderer.cs @@ -1,16 +1,11 @@ using System; using System.Globalization; -using System.Linq; using System.Text; -using NLog.Common; using NLog.Config; using NLog.LayoutRenderers; using NLog.Web.Internal; #if !ASP_NET_CORE using System.Web; -#else -using Microsoft.AspNetCore.Http.Features; - #endif namespace NLog.Web.LayoutRenderers @@ -88,23 +83,16 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) } var context = HttpContextAccessor.HttpContext; - if (context?.Session == null) - { - InternalLogger.Trace("aspnet-session - HttpContext Session is null"); + var contextSession = context.TryGetSession(); + if (contextSession == null) return; - } #if !ASP_NET_CORE - var value = PropertyReader.GetValue(Variable, context.Session, (session,key) => session.Count > 0 ? session[key] : null, EvaluateAsNestedProperties); + var value = PropertyReader.GetValue(Variable, contextSession, (session,key) => session.Count > 0 ? session[key] : null, EvaluateAsNestedProperties); #else //because session.get / session.getstring also creating log messages in some cases, this could lead to stackoverflow issues. //We remember on the context.Items that we are looking up a session value so we prevent stackoverflows - if (context.Items == null || context.Features.Get()?.Session == null) - { - return; - } - - if (context.Items.Count > 0 && context.Items.ContainsKey(NLogRetrievingSessionValue)) + if (context.Items == null || (context.Items.Count > 0 && context.Items.ContainsKey(NLogRetrievingSessionValue))) { return; } @@ -114,12 +102,7 @@ protected override void DoAppend(StringBuilder builder, LogEventInfo logEvent) object value; try { - value = PropertyReader.GetValue(Variable, context.Session, (session, key) => session.GetString(key), EvaluateAsNestedProperties); - } - catch (Exception ex) - { - InternalLogger.Warn(ex, "aspnet-session - Retrieving session value failed."); - return; + value = PropertyReader.GetValue(Variable, contextSession, (session, key) => session.GetString(key), EvaluateAsNestedProperties); } finally { From c0f393018176613f3a9237c1009f30556b76c9af Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Fri, 14 Jun 2019 08:48:42 +0000 Subject: [PATCH 03/14] Bump NLog from 4.6.4 to 4.6.5 in /src/NLog.Web Bumps [NLog](https://github.com/NLog/NLog) from 4.6.4 to 4.6.5. - [Release notes](https://github.com/NLog/NLog/releases) - [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md) - [Commits](https://github.com/NLog/NLog/compare/v4.6.4...v4.6.5) Signed-off-by: dependabot-preview[bot] --- src/NLog.Web/NLog.Web.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NLog.Web/NLog.Web.csproj b/src/NLog.Web/NLog.Web.csproj index 8730e3e6..2d6c7392 100644 --- a/src/NLog.Web/NLog.Web.csproj +++ b/src/NLog.Web/NLog.Web.csproj @@ -38,7 +38,7 @@ For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore NLog.snk - + From f1bcd083a1d53f71f71a00ed4603d6b4ec008312 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" Date: Fri, 14 Jun 2019 08:55:40 +0000 Subject: [PATCH 04/14] Bump NLog from 4.6.4 to 4.6.5 in /tests/NLog.Web.Tests Bumps [NLog](https://github.com/NLog/NLog) from 4.6.4 to 4.6.5. - [Release notes](https://github.com/NLog/NLog/releases) - [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md) - [Commits](https://github.com/NLog/NLog/compare/v4.6.4...v4.6.5) Signed-off-by: dependabot-preview[bot] --- src/NLog.Web/NLog.Web.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NLog.Web/NLog.Web.csproj b/src/NLog.Web/NLog.Web.csproj index 8730e3e6..2d6c7392 100644 --- a/src/NLog.Web/NLog.Web.csproj +++ b/src/NLog.Web/NLog.Web.csproj @@ -38,7 +38,7 @@ For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore NLog.snk - + From 2d10dd4dffb50a54ab4c4311a3a284379848976c Mon Sep 17 00:00:00 2001 From: Defee Date: Mon, 17 Jun 2019 07:19:35 +0200 Subject: [PATCH 05/14] aspnet-session - Reduce log-level to debug when session is not available (also check for feature) --- src/Shared/Internal/HttpContextExtensions.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Shared/Internal/HttpContextExtensions.cs b/src/Shared/Internal/HttpContextExtensions.cs index f7b7a8d0..1d2b95ff 100644 --- a/src/Shared/Internal/HttpContextExtensions.cs +++ b/src/Shared/Internal/HttpContextExtensions.cs @@ -4,6 +4,7 @@ #else using System.Text; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; #endif using NLog.Common; @@ -72,10 +73,18 @@ internal static ISession TryGetSession(this HttpContext context) { try { - var session = context?.Session; - if (session == null) - InternalLogger.Debug("HttpContext Session Lookup returned null"); - return session; + if (context?.Features.Get()?.Session != null) + { + var session = context?.Session; + if (session == null) + InternalLogger.Debug("HttpContext Session Lookup returned null"); + return session; + } + else + { + InternalLogger.Debug("HttpContext Session Feature not available"); + return null; + } } catch (InvalidOperationException ex) { From 5b5cd0c6d379944e6ec065a507d40802b8076eb1 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 20 Jun 2019 00:30:11 +0200 Subject: [PATCH 06/14] NLog.Web - Fixed appveyor.yml build script to use msbuild --- appveyor.yml | 7 +---- build_aspnet.bat | 13 +++++---- build_aspnetcore.bat | 28 ------------------- src/NLog.Web/NLog.Web.csproj | 53 ++++++++++++++++-------------------- 4 files changed, 32 insertions(+), 69 deletions(-) delete mode 100644 build_aspnetcore.bat diff --git a/appveyor.yml b/appveyor.yml index e10da0d4..2eac5d4b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,16 +35,11 @@ build_script: { $versionNuget = $versionPrefix + "-" + $versionSuffix } - $build_aspnet = "build_aspnet.bat", "-nuget_version=$versionNuget" + $build_aspnet = "build_aspnet.bat", "-version_prefix=$versionPrefix", "-version_build=$versionBuild", "-version_suffix=$versionSuffix" & cmd /c $build_aspnet if ($LastExitCode -ne 0) { throw "Exec: $ErrorMessage" } - $build_aspnetcore = "build_aspnetcore.bat", "-version_prefix=$versionPrefix", "-version_build=$versionBuild", "-version_suffix=$versionSuffix" - & cmd /c $build_aspnetcore - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } deploy: - provider: NuGet diff --git a/build_aspnet.bat b/build_aspnet.bat index d17b0226..085afade 100644 --- a/build_aspnet.bat +++ b/build_aspnet.bat @@ -1,16 +1,19 @@ @echo off rem fallback if not passed -set nuget_version=1.0.0 +set version_prefix=1.0.0 +set version_suffix= +set version_build=%version_prefix% call :read_params %* -nuget restore NLog.Web.sln -verbosity quiet -msbuild NLog.Web.sln /verbosity:minimal /t:rebuild /p:configuration=release +msbuild NLog.Web.sln /t:restore,rebuild /p:configuration=release /verbosity:minimal IF ERRORLEVEL 1 EXIT /B 1 -nuget pack src\NLog.Web\NLog.Web.csproj -properties Configuration=Release;Platform=AnyCPU -version %nuget_version% + +msbuild src\NLog.Web /t:rebuild,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:VersionPrefix=%version_prefix% /p:FileVersion=%version_build% /p:VersionSuffix=%version_suffix% IF ERRORLEVEL 1 EXIT /B 1 -nuget pack src\NLog.Web\NLog.Web.csproj -properties Configuration=Release;Platform=AnyCPU -version %nuget_version% -symbols + +msbuild src\NLog.Web.AspNetCore /t:rebuild,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:VersionPrefix=%version_prefix% /p:FileVersion=%version_build% /p:VersionSuffix=%version_suffix% IF ERRORLEVEL 1 EXIT /B 1 rem read pass parameters by name diff --git a/build_aspnetcore.bat b/build_aspnetcore.bat deleted file mode 100644 index 94b7c687..00000000 --- a/build_aspnetcore.bat +++ /dev/null @@ -1,28 +0,0 @@ -@echo off - -rem fallback if not passed -set version_prefix=1.0.0 -set version_suffix= -set version_build=%version_prefix% - -call :read_params %* - -msbuild src\NLog.Web.AspNetCore /t:restore,pack /p:configuration=release /verbosity:minimal /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:VersionPrefix=%version_prefix% /p:FileVersion=%version_build% /p:VersionSuffix=%version_suffix% -IF ERRORLEVEL 1 EXIT /B 1 - -rem read pass parameters by name -:read_params -if not %1/==/ ( - if not "%__var%"=="" ( - if not "%__var:~0,1%"=="-" ( - endlocal - goto read_params - ) - endlocal & set %__var:~1%=%~1 - ) else ( - setlocal & set __var=%~1 - ) - shift - goto read_params -) -exit /B \ No newline at end of file diff --git a/src/NLog.Web/NLog.Web.csproj b/src/NLog.Web/NLog.Web.csproj index 2d6c7392..81d78bfe 100644 --- a/src/NLog.Web/NLog.Web.csproj +++ b/src/NLog.Web/NLog.Web.csproj @@ -1,37 +1,34 @@  - net35 - NLog.Web - NLog.Web - Extend NLog with targets and layout renderers for websites and web applications. + PackageReference + net35 + NLog.Web v$(VersionPrefix) + +Extend NLog with targets and layout renderers for websites and web applications. This package is for ASP.NET 3.5+ -For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore - Copyright 2014-2019 - 4.0.0.0 - 4.0.0.0 - true - NLog - https://nlog-project.org/N.png +For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore + + Julian Verdurmen + NLog + $([System.DateTime]::Now.ToString(yyyy)) + Copyright (c) 2015-$(CurrentYear) NLog Project - https://nlog-project.org/ + NLog.Web NLog.Web - https://github.com/NLog/NLog.Web/blob/master/LICENSE - https://github.com/NLog/NLog.Web + nlog log target layoutrenderer web asp.net httpcontext -- Added AspNetLayoutRendererBase.Register for registering lambdas with httpcontext (@304NotModified) -- Fix NotSupportedException with ${aspnet-request-posted-body} (@304NotModified) +- Fixed Nuget-Package generation to include valid dependencies and release notes. - nlog log target layoutrenderer web asp.net httpcontext + https://nlog-project.org/N.png + https://github.com/NLog/NLog.Web + https://github.com/NLog/NLog.Web/blob/master/LICENSE + git + git://github.com/NLog/NLog.Web + true + 4.0.0.0 + true true - - - pdbonly - true - - - TRACE;DEBUG;NET451 - true - full - false + $(Title) true @@ -41,13 +38,9 @@ For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore - - - - From 614aa70151fe1c26c9d488ce98d5442693a473d1 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 20 Jun 2019 00:42:33 +0200 Subject: [PATCH 07/14] Skip examples projects on release build --- NLog.Web.sln | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/NLog.Web.sln b/NLog.Web.sln index 1cf07264..422ed6d7 100644 --- a/NLog.Web.sln +++ b/NLog.Web.sln @@ -4,9 +4,9 @@ VisualStudioVersion = 15.0.26730.16 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{52CA242D-DB20-41D9-8B79-A5A965ECA105}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Web", "src\NLog.Web\NLog.Web.csproj", "{E30DC886-8431-4CFA-90FA-38D9BE4203A0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Web", "src\NLog.Web\NLog.Web.csproj", "{E30DC886-8431-4CFA-90FA-38D9BE4203A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Web.Tests", "tests\NLog.Web.Tests\NLog.Web.Tests.csproj", "{E318FB41-9712-44CA-B792-E865EFE1A564}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Web.Tests", "tests\NLog.Web.Tests\NLog.Web.Tests.csproj", "{E318FB41-9712-44CA-B792-E865EFE1A564}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Web.AspNetCore", "src\NLog.Web.AspNetCore\NLog.Web.AspNetCore.csproj", "{9E3F7ECB-A6ED-422E-8429-F96C510F59CF}" EndProject @@ -43,11 +43,9 @@ Global {D43A99EE-F27F-4552-9E23-C9686809AC3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D43A99EE-F27F-4552-9E23-C9686809AC3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D43A99EE-F27F-4552-9E23-C9686809AC3D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D43A99EE-F27F-4552-9E23-C9686809AC3D}.Release|Any CPU.Build.0 = Release|Any CPU {0BF1FB4E-D5AE-46DE-9E80-E2DD40235552}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0BF1FB4E-D5AE-46DE-9E80-E2DD40235552}.Debug|Any CPU.Build.0 = Debug|Any CPU {0BF1FB4E-D5AE-46DE-9E80-E2DD40235552}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0BF1FB4E-D5AE-46DE-9E80-E2DD40235552}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From ee3ae5d7665a5e2fc4fafa8c6cb2d343e4abdff5 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 20 Jun 2019 00:48:18 +0200 Subject: [PATCH 08/14] Build should fail when test is failing --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2eac5d4b..43cf2229 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,8 +49,8 @@ deploy: branch: master test_script: - nuget.exe install OpenCover -ExcludeVersion -DependencyVersion Ignore - - OpenCover\tools\OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"\"c:\projects\nlogweb\tests\NLog.Web.Tests\bin\Release\net452\NLog.Web.Tests.dll\" -appveyor -noshadow" -returntargetcode -filter:"+[NLog.Web]*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -oldstyle -output:coverage.xml - - OpenCover\tools\OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"\"c:\projects\nlogweb\tests\NLog.Web.AspNetCore.Tests\bin\Release\net461\NLog.Web.AspNetCore.Tests.dll\" -appveyor -noshadow" -filter:"+[NLog.Web]*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -oldstyle -mergeoutput -output:coverage.xml + - OpenCover\tools\OpenCover.Console.exe -register:user -returntargetcode -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"\"c:\projects\nlogweb\tests\NLog.Web.Tests\bin\Release\net452\NLog.Web.Tests.dll\" -appveyor -noshadow" -returntargetcode -filter:"+[NLog.Web]*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -oldstyle -output:coverage.xml + - OpenCover\tools\OpenCover.Console.exe -register:user -returntargetcode -target:"%xunit20%\xunit.console.x86.exe" -targetargs:"\"c:\projects\nlogweb\tests\NLog.Web.AspNetCore.Tests\bin\Release\net461\NLog.Web.AspNetCore.Tests.dll\" -appveyor -noshadow" -filter:"+[NLog.Web]*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -oldstyle -mergeoutput -output:coverage.xml - pip install codecov - codecov -f "coverage.xml" From b1586df12ac534f07a7a4a764837a471ee59d3f1 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 20 Jun 2019 01:18:53 +0200 Subject: [PATCH 09/14] AspNetSessionValueLayoutRenderer is no longer swallowing random exceptions --- src/NLog.Web/NLog.Web.csproj | 2 +- .../AspNetSessionValueLayoutRendererTests2.cs | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/NLog.Web/NLog.Web.csproj b/src/NLog.Web/NLog.Web.csproj index 81d78bfe..8f811b82 100644 --- a/src/NLog.Web/NLog.Web.csproj +++ b/src/NLog.Web/NLog.Web.csproj @@ -17,7 +17,7 @@ For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore NLog.Web nlog log target layoutrenderer web asp.net httpcontext -- Fixed Nuget-Package generation to include valid dependencies and release notes. +- Fixed Nuget-Package generation to include dependencies and release notes. https://nlog-project.org/N.png https://github.com/NLog/NLog.Web diff --git a/tests/Shared/LayoutRenderers/AspNetSessionValueLayoutRendererTests2.cs b/tests/Shared/LayoutRenderers/AspNetSessionValueLayoutRendererTests2.cs index 26918a6f..64684435 100644 --- a/tests/Shared/LayoutRenderers/AspNetSessionValueLayoutRendererTests2.cs +++ b/tests/Shared/LayoutRenderers/AspNetSessionValueLayoutRendererTests2.cs @@ -49,19 +49,6 @@ public void MissingItemRendersEmpty() // Assert Assert.Empty(result); } - [Fact] - public void ThrowItemRendersEmpty() - { - // Arrange - var (renderer, _) = CreateRenderer(true); - renderer.Variable = "a"; - - // Act - string result = renderer.Render(LogEventInfo.CreateNullEvent()); - - // Assert - Assert.Empty(result); - } private static (AspNetSessionValueLayoutRenderer, HttpContext) CreateRenderer(bool throwsError = false) { From 827088fee965e960d5f606613ab791f2529110b2 Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <304NotModified@users.noreply.github.com> Date: Sat, 22 Jun 2019 23:59:41 +0200 Subject: [PATCH 10/14] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dfae91cd..7536d7a3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![NLog](https://raw.githubusercontent.com/NLog/NLog.github.io/master/images/NLog-logo-only_small.png) + # NLog.Web (ASP.NET & ASP.NET Core) [![AppVeyor](https://img.shields.io/appveyor/ci/nlog/nlog-web/master.svg)](https://ci.appveyor.com/project/nlog/nlog-web/branch/master) [![codecov.io](https://codecov.io/github/NLog/NLog.Web/coverage.svg?branch=master)](https://codecov.io/github/NLog/NLog.Web?branch=master) [![BCH compliance](https://bettercodehub.com/edge/badge/NLog/NLog.Web)](https://bettercodehub.com/results/NLog/NLog.Web) From f3e96417f02284ee49a2f5799bd4382a468a394e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2019 05:40:38 +0000 Subject: [PATCH 11/14] Bump Microsoft.NET.Test.Sdk in /tests/NLog.Web.AspNetCore.Tests Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.1.1 to 16.2.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.1.1...v16.2.0) Signed-off-by: dependabot-preview[bot] --- .../NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj b/tests/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj index c71a2212..33b2423e 100644 --- a/tests/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj +++ b/tests/NLog.Web.AspNetCore.Tests/NLog.Web.AspNetCore.Tests.csproj @@ -23,7 +23,7 @@ - + From 1290ec7f6a23cc21fa23e92cf04a7238fa420ef9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2019 05:41:48 +0000 Subject: [PATCH 12/14] Bump Microsoft.NET.Test.Sdk in /tests/NLog.Web.Tests Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.1.1 to 16.2.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.1.1...v16.2.0) Signed-off-by: dependabot-preview[bot] --- tests/NLog.Web.Tests/NLog.Web.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NLog.Web.Tests/NLog.Web.Tests.csproj b/tests/NLog.Web.Tests/NLog.Web.Tests.csproj index 21c89802..7d0597ee 100644 --- a/tests/NLog.Web.Tests/NLog.Web.Tests.csproj +++ b/tests/NLog.Web.Tests/NLog.Web.Tests.csproj @@ -18,7 +18,7 @@ - + From 9c3f5dc5d2b09662b38ec4168c864906a56f4783 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Sun, 30 Jun 2019 21:31:54 +0200 Subject: [PATCH 13/14] NLog.Web - Fixed RepositoryUrl for git repository --- src/NLog.Web/NLog.Web.csproj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/NLog.Web/NLog.Web.csproj b/src/NLog.Web/NLog.Web.csproj index 8f811b82..a6648453 100644 --- a/src/NLog.Web/NLog.Web.csproj +++ b/src/NLog.Web/NLog.Web.csproj @@ -23,17 +23,16 @@ For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore https://github.com/NLog/NLog.Web https://github.com/NLog/NLog.Web/blob/master/LICENSE git - git://github.com/NLog/NLog.Web + https://github.com/NLog/NLog.Web.git + true 4.0.0.0 + NLog.snk + true true $(Title) - - true - NLog.snk - From b9f8a32200ddea1eabf02975f0be3c2e91c97346 Mon Sep 17 00:00:00 2001 From: Julian Verdurmen <304NotModified@users.noreply.github.com> Date: Tue, 2 Jul 2019 23:04:11 +0200 Subject: [PATCH 14/14] Version 4.8.4 --- CHANGELOG.MD | 8 +++++++- appveyor.yml | 4 ++-- src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj | 3 +-- src/NLog.Web/NLog.Web.csproj | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 418f8b7a..c72f9305 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -5,8 +5,14 @@ See also [releases](https://github.com/NLog/NLog.Web/releases) and [milestones]( Date format: (year/month/day) +### v4.8.4 aspnetcore (2019/07/02) +- [#436](https://github.com/NLog/NLog.Web/pull/436) Better checking for availability of session (@Defee, @snakefoot) -### v4.8.3 aspnetcore & aspnet4 (2019/06/05) +### v4.8.4 aspnet4 (2019/07/02) +- [#442](https://github.com/NLog/NLog.Web/pull/442) Fixed Nuget-Package generation to include dependencies and release notes (@snakefoot) +- [#436](https://github.com/NLog/NLog.Web/pull/436) Better checking for availability of session (@Defee, @snakefoot) + +### v4.8.3 aspnetcore & aspnet4 (2019/06/05) - [#428](https://github.com/NLog/NLog.Web/pull/428) Added AspNetLayoutRendererBase.Register for registering lambdas with httpcontext (@304NotModified) - [#431](https://github.com/NLog/NLog.Web/pull/431) Fix NotSupportedException with ${aspnet-request-posted-body} (@304NotModified) diff --git a/appveyor.yml b/appveyor.yml index 43cf2229..8b20fe64 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 4.8.3.{build} +version: 4.8.4.{build} clone_folder: c:\projects\nlogweb configuration: Release image: Visual Studio 2017 @@ -22,7 +22,7 @@ skip_tags: true build_script: - ps: | - $versionPrefix = "4.8.3" + $versionPrefix = "4.8.4" $versionSuffix = "" $versionBuild = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER} $versionNuget = $versionPrefix diff --git a/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj b/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj index bbcb4900..53023402 100644 --- a/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj +++ b/src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj @@ -20,8 +20,7 @@ Supported platforms: NLog.Web.AspNetCore logging;log;session;NLog;web;aspnet;aspnetcore;MVC;httpcontext -- Added AspNetLayoutRendererBase.Register for registering lambdas with httpcontext (@304NotModified) -- Fix NotSupportedException with ${aspnet-request-posted-body} (@304NotModified) +- Better checking for availability of session (@Defee, @snakefoot) https://nlog-project.org/N.png https://github.com/NLog/NLog.Web diff --git a/src/NLog.Web/NLog.Web.csproj b/src/NLog.Web/NLog.Web.csproj index a6648453..3e16b54a 100644 --- a/src/NLog.Web/NLog.Web.csproj +++ b/src/NLog.Web/NLog.Web.csproj @@ -17,7 +17,8 @@ For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore NLog.Web nlog log target layoutrenderer web asp.net httpcontext -- Fixed Nuget-Package generation to include dependencies and release notes. +- Better checking for availability of session (@Defee, @snakefoot) +- Fixed Nuget-Package generation to include dependencies and release notes (@snakefoot) https://nlog-project.org/N.png https://github.com/NLog/NLog.Web