ObjectPath Layout Renderer
Ben Johnson edited this page Nov 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 catch new 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
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json