Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

AspNetTraceIdentifier Layout Renderer

Rolf Kristensen edited this page Jun 10, 2023 · 8 revisions

ASP.NET Trace Identifier

Platforms Supported: All (Supported in ASP.NET Core and ASP.NET)

Introduced in NLog.Web.AspNetCore ver. 4.3.1 and NLog.Web ver. 4.7.1

Configuration Syntax

${aspnet-TraceIdentifier:ignoreActivityId=boolean}

Options:

  • ignoreActivityId: Only ASP.NET Core. Use HttpContext.TraceIdentifier instead of System.Diagnostics.Activity.Current.Id

Notes

Which TraceIdentifier is used?

  • ASP.NET Core 3: by default System.Diagnostics.Activity.Current.Id.
  • ASP.NET Core 1+2: HttpContext.TraceIdentifier
  • ASP.NET: HttpWorkerRequest.RequestTraceIdentifier.
    • Requires IIS ETW feature enabled, see Microsoft docs
    • Alternative could use ${activityid} together with CorrelationManager.ActivityId.

See code

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.