-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Debugger target
Rolf Kristensen edited this page Apr 21, 2026
·
21 revisions
Writes log messages to the attached managed debugger (Ex. Visual Studio Output Window). See also System.Diagnostics.Debugger.Log
Platforms Supported: All
<targets>
<target xsi:type="Debugger" name="String" layout="Layout" />
</targets>Read more about using the Configuration File.
- name - Name of the target.
-
layout - Text to be rendered. Layout Required. Default:
${longdate}|${level:uppercase=true}|${logger}|${message:withexception=true} - header - Layout used to format header-output when initializing.
- footer - Layout used to format footer-output when closing.
-
Category - Layout used to format the category. Default:
${logger}Introduced with NLog v6.1
-
MaxMessageSize - Max message length in characters before applying
OnOverflow-action (0 means unlimited) . Default:0.Introduced with NLog v6.1
-
OnOverflow - Action to perform when max message size is exceeded. Default:
SplitIntroduced with NLog v6.1
-
Truncate- Truncate the message to fit. -
Split- Split the big message into multiple log messages. -
Discard- Discard the entire message.
-
From stackoverflow
<targets>
<target name="debugger" xsi:type="Debugger" layout="${level}|${message:withException=true}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="debugger" />
</rules>Alternative targets for diagnostic output:
-
Trace-target for output to
System.Diagnostics.Trace -
DebugSystem-target for output to
System.Diagnostics.Debug -
OutputDebugString-target for output to
OutputDebugStringWin32 API
- 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