-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Identity layout renderer
Thread identity information (name and authentication information).
Platforms Supported: Limited (Not supported on NetStandard1.3+1.5)
${identity:authType=Boolean:separator=String:name=Boolean
:isAuthenticated=Boolean}
- authType - Indicates whether to render Thread.CurrentPrincipal.Identity.AuthenticationType.Boolean Default: True
- separator - Separator to be used when concatenating parts of identity information. Default: :
- name - Indicates whether to render Thread.CurrentPrincipal.Identity.Name.Boolean Default: True
- isAuthenticated - Indicates whether to render Thread.CurrentPrincipal.Identity.IsAuthenticated.Boolean Default: True
-
${environment-user} is an alternative that depends on Environment.UserName, which is compatible with both Windows/Linux (and less overhead).
-
${windows-identity} is an alternative that depends on WindowsIdentity.Getcurrent()
-
${aspnet-user-identity} is an alternative that only works on ASP.NET Applications with identity enabled.
Set AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.UnauthenticatedPrincipal)
in the Main method of your application, otherwise this renderer could render empty unexpectedly. (Read more)
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
- Articles about NLog
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json