logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Logging stack trace
Date Fri, 02 Feb 2007 05:11:28 GMT
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

[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 <Marcus.Widerberg@tetrapak.com>
To: Log4NET User <log4net-user@logging.apache.org>
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?


Wayne Bradney wrote:
> Marcus,
> Take a look at System.Diagnostics.StackTrace

View raw message