-
Notifications
You must be signed in to change notification settings - Fork 1.4k
WhenContains filter
Rolf Kristensen edited this page Nov 27, 2021
·
5 revisions
Matches when the calculated layout contains the specified substring. This filter is deprecated in favour of <when /> which is based on conditions.
Platforms Supported: All
<rules>
<logger ... >
<filters>
<whenContains layout="Layout" substring="String" action="Enum" ignoreCase="Boolean"/>
</filters>
</logger>
</rules>
- layout - Layout to be used to filter log messages. Layout Required.
- substring - Substring to be matched. Required.
-
action - Action to be taken when filter matches. Required.
Possible values:- Ignore - The message should not be logged.
- IgnoreFinal - The message should not be logged and processing should be finished.
- Log - The message should be logged.
- LogFinal - The message should be logged and processing should be finished.
- Neutral - The filter doesn't want to decide whether to log or discard the message.
- ignoreCase - Indicates whether to ignore case when comparing strings. Boolean Default: False
- 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