-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Stack Trace Layout Renderer
Rolf Kristensen edited this page Nov 26, 2021
·
12 revisions
Render Stack trace of a log event.
Platforms Supported: Limited (Not supported on NetStandard 1.3)
${stacktrace:format=Enum:topFrames=Integer:skipFrames=Integer:separator=String}
-
format - Output format of the stack trace. Default: Flat
Possible values:- DetailedFlat - Detailed flat format (method signatures displayed in a single line).
- Flat - Flat format (class and method names displayed in a single line).
- Raw - Raw format (multiline - as returned by StackFrame.ToString() method).
- topFrames - Number of top stack frames to be rendered. Integer Default: 3
- skipFrames - Numberof frames to skip. Integer Default: 0
-
separator - Stack frame separator string. Default: =>. To set new line use
-
captureStackTrace - Logger should capture StackTrace, if it was not provided manually. Default: true
Introduced with NLog 4.7.1
-
reverse - Whether to output the stacktrace in reverse order. Default:
false
Introduced with NLog 5.0
Note: To get the filenames and line numbers, include the PDB files.
Note: Prior NLog 4.4.7, the result was always <filename unknown>:0:0
Main at offset 638 in file:line:column file1.cs:100:10
TestLogging at offset 590 in file:line:column testlogger.cs:30:10
WriteToLog at offset 112 in file:line:column testlogger.cs:10:20
Program.Main
Program.TestLogging
NLogLoggerHelper.LogEvent
[Int32 Main()]
[Void TestLogging()]
[Void WriteToLog(NLog.Logger, NLog.LogLevel, System.String)]
- 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