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: How to get line number and file name in custom Appender?
Date Tue, 04 May 2010 20:59:23 GMT
Some stacktrace information like line numbers are not available in release builds.


----- Original Message ----
From: ITemplate <itemplate@hotmail.com>
To: log4net-user@logging.apache.org
Sent: Tue, May 4, 2010 4:24:49 PM
Subject: Re: How to get line number and file name in custom Appender?


Hi Yuriy,

Thanks for your reply. I gotta say, I was a bit surprised to see that
log4net per default could write out stack information - is the stacktrace
collected at all times? It would seem so...

-- 
Werner




Yuriy Taraday wrote:
> 
> 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.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-get-line-number-and-file-name-in-custom-Appender--tp28447536p28452662.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Mime
View raw message