logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuriy Taraday <yorik....@gmail.com>
Subject Re: How to get line number and file name in custom Appender?
Date Tue, 04 May 2010 14:47:24 GMT
http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html
Note about caller location information.
The following patterns %type %file %line %method %location %class %C
%F %L %l %M all generate caller location information. Location
information uses the System.Diagnostics.StackTrace class to generate a
call stack. The caller's information is then extracted from this
stack.

You should dig this way.
But you better should not log this. Use Stacks/Properties instead to
localize logging point in the source. It may not be as accurate as
StackTrace but it is appropriate and reliable.

On Tue, May 4, 2010 at 5:50 PM, ITemplate <itemplate@hotmail.com> wrote:
>
> Hi,
>
> Using a file appender, I can write the source code line number in my log
> file using "%line". But if I have a custom Appender with the "LoggingEvent"
> - where is that information stored and retrievable?
>
> --
> Werner
> --
> View this message in context: http://old.nabble.com/How-to-get-line-number-and-file-name-in-custom-Appender--tp28447536p28447536.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message