-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Null target
Rolf Kristensen edited this page Nov 27, 2021
·
12 revisions
Discards log messages. Used mainly for debugging and benchmarking.
Platforms Supported: All
<targets>
<target xsi:type="Null" name="String" formatMessage="Boolean" layout="Layout" />
</targets>
Read more about using the Configuration File.
- name - Name of the target.
-
formatMessage - Indicates whether to perform layout calculation. Boolean Default: False
-
layout - Layout used to format log messages. Boolean Required. Default:
${longdate}|${level:uppercase=true}|${logger}|${message:withexception=true}
This example is useful for testing the performance of the NLog engine. Logging rule without any writeTo=
option is much faster way to do filtering (Zero allocation).
<targets>
<target xsi:type="Null" name="BlackHole" formatMessage="false" />
</targets>
<rules>
<!-- ignore events written that are written to a logger which starts with "Namespace." -->
<logger name="Namespace.*" minlevel="Debug" writeTo="BlackHole" final="true" />
</rules>
- 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