Skip to content

Commit

Permalink
Merge pull request #445 from NLog/release/4.8.4
Browse files Browse the repository at this point in the history
Release 4.8.4
  • Loading branch information
repo-ranger[bot] authored Jul 2, 2019
2 parents d6a51f5 + b9f8a32 commit d72c156
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 185 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 2 additions & 4 deletions NLog.Web.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
15 changes: 5 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -54,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"

Expand Down
13 changes: 8 additions & 5 deletions build_aspnet.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
28 changes: 0 additions & 28 deletions build_aspnetcore.bat

This file was deleted.

3 changes: 1 addition & 2 deletions src/NLog.Web.AspNetCore/NLog.Web.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Supported platforms:
<PackageId>NLog.Web.AspNetCore</PackageId>
<PackageTags>logging;log;session;NLog;web;aspnet;aspnetcore;MVC;httpcontext</PackageTags>
<PackageReleaseNotes>
- 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)
</PackageReleaseNotes>
<PackageIconUrl>https://nlog-project.org/N.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/NLog/NLog.Web</PackageProjectUrl>
Expand Down
61 changes: 27 additions & 34 deletions src/NLog.Web/NLog.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,53 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net35</TargetFramework>
<AssemblyTitle>NLog.Web</AssemblyTitle>
<Product>NLog.Web</Product>
<Description>Extend NLog with targets and layout renderers for websites and web applications.
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<TargetFrameworks>net35</TargetFrameworks>
<Product>NLog.Web v$(VersionPrefix)</Product>
<Description>
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 </Description>
<Copyright>Copyright 2014-2019</Copyright>
<Version>4.0.0.0</Version>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Authors>NLog</Authors>
<PackageIconUrl>https://nlog-project.org/N.png</PackageIconUrl>
For ASP.NET Core: Check https://www.nuget.org/packages/NLog.Web.AspNetCore
</Description>
<Authors>Julian Verdurmen</Authors>
<Company>NLog</Company>
<CurrentYear>$([System.DateTime]::Now.ToString(yyyy))</CurrentYear>
<Copyright>Copyright (c) 2015-$(CurrentYear) NLog Project - https://nlog-project.org/ </Copyright>
<AssemblyName>NLog.Web</AssemblyName>
<PackageId>NLog.Web</PackageId>
<PackageLicenseUrl>https://github.com/NLog/NLog.Web/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/NLog/NLog.Web</PackageProjectUrl>
<PackageTags>nlog log target layoutrenderer web asp.net httpcontext</PackageTags>
<PackageReleaseNotes>
- 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)
- Fixed Nuget-Package generation to include dependencies and release notes (@snakefoot)
</PackageReleaseNotes>
<PackageTags>nlog log target layoutrenderer web asp.net httpcontext</PackageTags>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>TRACE;DEBUG;NET451</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup>
<PackageIconUrl>https://nlog-project.org/N.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/NLog/NLog.Web</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/NLog/NLog.Web/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/NLog/NLog.Web.git</RepositoryUrl>

<SignAssembly>true</SignAssembly>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyOriginatorKeyFile>NLog.snk</AssemblyOriginatorKeyFile>

<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyTitle>$(Title)</AssemblyTitle>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="4.6.4" />
<PackageReference Include="NLog" Version="4.6.5" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Configuration" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared\**\*.cs" />
Expand Down
97 changes: 97 additions & 0 deletions src/Shared/Internal/HttpContextExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using System;
#if !ASP_NET_CORE
using System.Web;
#else
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
#endif
using NLog.Common;

namespace NLog.Web.Internal
{
internal static class HttpContextExtensions
{
#if !ASP_NET_CORE
internal static HttpRequestBase TryGetRequest(this HttpContextBase context)
{
try
{
var request = context?.Request;
if (request == null)
InternalLogger.Debug("HttpContext Request Lookup returned null");
return request;
}
catch (HttpException ex)
{
InternalLogger.Debug(ex, "HttpContext Request Lookup failed.");
return null;
}
}
#else
internal static HttpRequest TryGetRequest(this HttpContext context)
{
var request = context?.Request;
if (request == null)
InternalLogger.Debug("HttpContext Request Lookup returned null");
return request;
}
#endif

#if ASP_NET_CORE
internal static string GetString(this ISession session, string key)
{
if (!session.TryGetValue(key, out var data))
{
return null;
}

if (data == null)
{
return null;
}

if (data.Length == 0)
{
return string.Empty;
}

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
{
if (context?.Features.Get<ISessionFeature>()?.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)
{
InternalLogger.Debug(ex, "HttpContext Session Lookup failed.");
return null; // System.InvalidOperationException: Session has not been configured for this application or request.
}
}
#endif
}
}
57 changes: 0 additions & 57 deletions src/Shared/Internal/RequestAccessorExtension.cs

This file was deleted.

Loading

0 comments on commit d72c156

Please sign in to comment.