NLog.Web.AspNetCore
v6.3.0Latest Stable
net10.0net11.0.NETFramework4.6.2net8.0.NETStandard2.0
Integrates NLog as provider for Microsoft.Extensions.Logging, and provides NLog LayoutRenderers to enrich logging output with details from HttpContext.
Published
Nov 10, 2026
12d ago
Total Downloads
189.6M
189,603,260
Install
dotnet add package NLog.Web.AspNetCore --version 6.3.0
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
NLog.Web.AspNetCore
NLog.Web.AspNetCore integrates NLog as a logging provider for Microsoft.Extensions.Logging by calling UseNLog() on the application HostBuilder.
Application code can continue using ILogger<T>, while NLog provides powerful logging capabilities including:
- Enrich logging output with additional details from active HttpContext using NLog LayoutRenderers, by just updating the NLog configuration.
- Supports middleware injection for HTTP Request Logging and HTTP Response Logging.
- Load NLog configuration from appsettings.json
- Capture structured message properties from the Microsoft ILogger
- Capture scope context properties from the Microsoft ILogger
BeginScope - Routing logging output to multiple destinations via the available NLog Targets
- Rendering logging output into standard formats like JSON, CVS, W3C ELF and XML using NLog Layouts.
- Contributions are always welcome, by creating a pull request.
Supported platforms:
- ASP.NET Core 8, 9, 10 and 11
- ASP.NET Core 2, .NET Standard 2.0 and .NET 4.6.2+
Register NLog as logging provider:
builder.Logging.ClearProviders();
builder.Host.UseNLog();
If logging is needed before the host building, then one can use fluent setup:
var logger = NLog.LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
Useful Links:
Changes from Previous Version
v6.2.2v6.3.0
Added Frameworks
net11.0
Removed Frameworks
net6.0
Added Dependencies
NLog.Extensions.Logging(net11.0)
Removed Dependencies
NLog.Extensions.Logging(net6.0)
Adoption Assessment
Teams already using NLog or requiring its configuration-oriented routing model.
Compatibility metadata lists 5 target frameworks; confirm the exact target used by your application.
Editorial Note: NLog integration for ASP.NET Core with flexible target and rule configuration. Trade-off: Avoid adding a second logging pipeline when the existing provider already meets the requirement.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.