Integrates NLog as provider for Microsoft.Extensions.Logging, and provides NLog LayoutRenderers to enrich logging output with details from HttpContext.
$ dotnet add package NLog.Web.AspNetCoreIntegrates NLog as Logging provider for the ASP.NET Core platform, by just calling UseNLog() with the application host-builder.
Providing features like:
BeginScopeSupported platforms:
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();
Alternative include NLog.Web.AspNetCore extension in the NLog.config file:
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
Useful Links: