- Notifications
You must be signed in to change notification settings - Fork1.4k
AspNetTraceIdentifier Layout Renderer
Rolf Kristensen edited this pageJun 10, 2023 ·8 revisions
ASP.NET Trace Identifier
Platforms Supported:All (Supported inASP.NET Core andASP.NET)
Introduced in NLog.Web.AspNetCore ver. 4.3.1 and NLog.Web ver. 4.7.1
${aspnet-TraceIdentifier:ignoreActivityId=boolean}- ignoreActivityId: Only ASP.NET Core. Use
HttpContext.TraceIdentifierinstead ofSystem.Diagnostics.Activity.Current.Id
- 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, seeMicrosoft docs
- Alternative could use${activityid} together with
CorrelationManager.ActivityId.
Seecode
-Troubleshooting Guide - See available NLog Targets and Layouts:https://nlog-project.org/config
- All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json