- Notifications
You must be signed in to change notification settings - Fork1.4k
ObjectPath Layout Renderer
Ben Johnson edited this pageNov 11, 2019 ·4 revisions
Render a property of an object.
Introducted in NLog 4.6.7
Platforms Supported:All
${object-path:${exception}:path=String:Format=String:Culture=String}${exception:objectpath=String} // Ambient way- objectpath - Path to the property. Nested properties are supported. Arrays aren't supported.
- format - Format when rendering.
- culture - Culture code used for formatting.
Assume we catchnew ExternalException("Exception with errorCode", 5000)
${exception:objectpath=HResult} // results in 5000${object-path:${exception}:path=HResult:Culture=NL-nl:format=N2}"; // results in 5.000,00-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