Integrates NLog as Logging provider for the ASP.NET Core platform, by just calling UseNLog() with the application host-builder.
Providing features like:
- 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 6, 7, 8, 9 and 10
- 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();Alternative include NLog.Web.AspNetCore extension in the NLog.config file:
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>Useful Links:
