These packages are extensions to NLog, and provides targets and layout-renderes specific to ASP.NET (Core), MVC and IIS.
- Getting started for ASP.NET Core 6
- Getting started for ASP.NET Core 5
- Getting started for ASP.NET Core 3.1
- Getting started for .NET Core Console application
- How to use structured logging
- Blog posts for how to get started with ASP.NET Core and NLog
- All config options: nlog-project.org/config
For updates and releases, check CHANGELOG.MD or Releases
The NLog.Web.AspNetCore-package supports the platforms:
- For ASP.NET Core 6, .NET 6
- For ASP.NET Core 5, .NET 5
- For ASP.NET Core 3, .NET Core 3
- For ASP.NET Core 2.1 .NET Standard 2.0 for .NET 4.6.1
ℹ️ Missing the trace and debug logs? Check your appsettings.json
Use the NLog.Web.AspNetCore package
The NLog.Web-package works with classic ASP.NET MVC
- Supported targets for ASP.NET
- Supported layout renderers for ASP.NET
- NLog 5.0 requires that NLog.config must include NLog.Web in extensions:
<!-- enable ASP.NET layout renderers -->
<extensions>
<add assembly="NLog.Web"/>
</extensions>
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>
Contributions are highly appreciated! Please make sure if works for ASP.NET and ASP.NET Core if possible and make sure it is covered by unit tests.
BSD