-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Trace target
Rolf Kristensen edited this page Oct 23, 2023
·
19 revisions
Sends log messages through System.Diagnostics.Trace.
Platforms Supported: Limited (Not available for NetStandard1.3)
<targets>
<target xsi:type="Trace" name="String" layout="Layout" />
</targets>
- name - Name of the target.
-
layout - Layout used to format log messages. Layout Required. Default:
${longdate}|${level:uppercase=true}|${logger}|${message:withexception=true}
-
rawWrite - Always use
Trace.WriteLine
independent of LogLevel. Default:False
Introduced with NLog 4.5, fixes the issue with output being prefixed with exe-filename.
-
EnableTraceFail - Use
Trace.Fail
for LogLevel.Fatal, instead ofTrace.Error
. Default: 'False'Introduced with NLog 4.7, avoids
Enviroment.FailFast
that can happen for default trace listener. -
header - Layout used to format header-output when initializing. Layout
Introduced with NLog 5.0
-
footer - Layout used to format footer-output when closing. Layout
Introduced with NLog 5.0
Alternative targets for diagnostic output:
-
DebugSystem-target for output to
System.Diagnostics.Debug
-
Debugger-target for output to
System.Diagnostics.Debugger.Log
-
OutputDebugString-target for output to
OutputDebugString
Win32 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