- Notifications
You must be signed in to change notification settings - Fork1.4k
Level layout renderer
Rolf Kristensen edited this pageJun 6, 2023 ·14 revisions
Thelog level.
Platforms Supported:All
${level:format=Ordinal}Alternatively, add padding to align the message.
${pad:padding=5:inner=${level:uppercase=true}}Alternatively, truncate to align the message:
${level:format=TriLetter:uppercase=true}uppercase - Output level in upper-case. Default:
falseIntroduced with NLog v5.0 to simplify default Layout, instead of using the ambientuppercase-property
format - Output format of the level. Introduced in 4.4.6 Default: Name
Possible values:- Name - Render the standard level name.
Introduced in NLog 4.4.6
- FullName - Render the full level name (Expands "Info" and "Warn")
Introduced in NLog 4.7
- FirstCharacter - Render the first character of the level.
Introduced in NLog 4.4.6
- Ordinal - Render the ordinal (aka number) for the level.
Introduced in NLog 4.4.6
- TriLetter - Renders LogLevel as 3 letter abbreviations (Trc, Dbg, Inf, Wrn, Err, Ftl)
Introduced in NLog 5.0.5
Name FullName TriLetter FirstCharacter Ordinal Trace Trace Trc T 0 Debug Debug Dbg D 1 Info Information Inf I 2 Warn Warning Wrn W 3 Error Error Err E 4 Fatal Fatal Ftl F 5 Off Off Off O 6 - Name - Render the standard level name.
Configuration:
${level}Code:
logger.Debug("Test Message")Result:
DebugConfiguration:
${level:format=FirstCharacter}Code:
logger.Debug("Test Message")Result:
D-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