StackTrace information is not stored on the LocationInfo object. We could add a
StackFrames property that contained each of the StackFrame objects that were a
part of the current StackTrace at the moment the log message was generated. We
would need to come up with some way of showing all or a subset of this
information (I think NLog has some sort of StackTrace output capabilities).
This pattern would the last 3 calls leading up the log message:
[%level] (%stackTrace{mostRecentFrames=3,seperator=>,pattern=%file:%method}) -
%message
If the log message originated from a DataGrid on an ASP.Net page that pattern
might expand to:
[DEBUG] (List.aspx.cs:Page_Load > List.aspx.cs:bindDataGrid >
List.aspx.cs:dgList_ItemDataBound) - Hello World
Of course that would only be useful for Debug builds and would probably be
relatively slow to generate.
----- Original Message ----
From: Widerberg Marcus <[EMAIL PROTECTED]>
To: Log4NET User <[email protected]>
Sent: Thursday, February 1, 2007 9:56:56 AM
Subject: RE: Logging stack trace
Hello Wayne,
Thanks for your reply.
Is anyone aware of if there is an way to expose a stacktrace property so that I
can add it to a layout? Either built-in or a suggestion for improvement?
/marcus
Wayne Bradney wrote:
> Marcus,
>
> Take a look at System.Diagnostics.StackTrace