StackTrace is internal .Net interface. Of course, .Net knows everything about currently executing code unless this information was wiped out by compiler/obfuscater/optimizer.
On Wed, May 5, 2010 at 12:24 AM, ITemplate <itempl...@hotmail.com> wrote: > > 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 <itempl...@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. > >