-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Replace NewLines Layout Renderer
Rolf Kristensen edited this page Jun 9, 2022
·
8 revisions
Replaces a new lines in the output of another layout with a string.
Platforms Supported: All
Introduced in NLog 4.1
For general purpose search and replace there is also ${replace}
${replace-newlines:inner=Layout:replacement=String}
-
replacement - Text to replace newlines with. Default is
" "
(space)
logger.Info("foo {0}", "bar" + System.Environment.NewLine + "123");
${replace-newlines:${message}}
Will result in "foo bar 123"
${replace-newlines:replacement=|:${message}}
Will result in "foo bar|123"
- 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