Skip to main content

Integrates NLog as provider for Microsoft.Extensions.Logging, and provides NLog LayoutRenderers to enrich logging output with details from HttpContext.

Total Downloads
189.6M
189,603,260
Published
Nov 10, 2026
12d ago

Get Started

dotnet add package NLog.Web.AspNetCore --version 6.3.0
ProductVersions
.NET
net10.0net11.0net8.0
.NET Standard
netstandard2.0
Other
.NETFramework4.6.2

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:

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:

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Teams already using NLog or requiring its configuration-oriented routing model.

Logging Guide
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.