-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Layout Renderers
Layout renderers are template macros that are used in Layouts, e.g. ${message}
, ${level}
etc
List of available layout renderers can be found here: https://nlog-project.org/config/?tab=layout-renderers
NLog can also be extended with new custom layout renderers. See also: Extending NLog
NLog Layout-format recognizes the colon-character :
as option-delimiter, but only when used inside ${
and }
. To avoid unexpected results, then one can escape using back-slash like this: \:
. Ex. ${date:format=HH\:mm\:ss}
Even though the layout renderers provide many pre-defined values, you may need to pass application specific values to your Layouts. You can provide own Context state, that can then be rendered by different Layouts. For example by using LogEvent Properties, that can be rendered using using the ${event-properties} renderer.
- 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