These packages are extensions to NLog.
The packages contain targets and layout-renderes specific to ASP.NET (Core), MVC and IIS.
- Getting started with ASP.NET Core 2
- Getting started with .NET Core 2 Console application
- Getting started with ASP.NET Core 1 (csproj - vs2017)
- Getting Started with ASP.NET Core 1 (project.json - vs2015)
- Multiple blogs to get started with ASP.NET Core and NLog
For updates and releases, check CHANGELOG.MD or Releases
ASP.NET Core 1, 2 and 3 are supported!
Supported platforms:
- For ASP.NET Core 3, .NET Core 3.0
- For ASP.NET Core 2, .NET Standard 2.0+ and .NET 4.6+
- For ASP.NET Core 1, .NET Standard 1.5+ and .NET 4.5.x
ℹ️ Missing the trace and debug logs in .NET Core 2? Check your appsettings.json
Use the NLog.Web.AspNetCore package
There is a special package for ASP.NET Core / MVC Core. This is needed because we can't detect if ASP.NET or ASP.NET Core is used. The package depends on NLog.Extensions.Logging - which integrates with the ASP.NET Core logging system.
Include in your nlog.config:
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
Use the NLog.Web package.
Simply install the package. NLog will detect the extension automatically.
note: not listed on https://nlog-project.org/config
There is a ASP.NET ASP.NET HttpModule that enables NLog to hook BeginRequest and EndRequest events easily.
The NLogHttpModule
needs a registration in the web.config:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="NLog" type="NLog.Web.NLogHttpModule, NLog.Web" />
</modules>
</system.webServer>
BSD