/NLog.Web

NLog targets specific for Web: ASP.NET & ASP.NET Core

Primary LanguageC#BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

NLog.Web (ASP.NET & ASP.NET Core) AppVeyor codecov.io

These packages are extensions to NLog.

The packages contain targets and layout-renderes specific to ASP.NET (Core), MVC and IIS.

ASP.NET: Version

ASP.NET Core: Version

ASP.NET

Simply install the package. NLog will detect the extension automatically.

ASP.NET Core

There is a special package for ASP.NET Core / MVC Core. This is needed because HttpContext.Current isn't available in ASP.NET Core and we can't detect if ASP.NET or ASP.NET Core is used. The package depends on NLog.Extensions.Logging

The following parts are supported in ASP.NET Core:

Introduced in NLog.Web 4.3 & NLog.Web.AspNetCore 4.3

Introduced in NLog.Web.AspNetCore 4.3.1

Usage

Content

This package contains one target, one target-wrapper, multiple layout renderers and one httpmodule.

Targets

  • AspNetTrace
  • AspNetBufferingWrapper

See Target documentation at the NLog wiki

Layout renderers

See Layout renderers documentation at the NLog wiki

Configuration

For the targets and layout renderers, no additional configuration is needed.

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>

License

BSD