Adam,
   Take a look at how Logger's info/warn/debug/error methods call forcedLog
passing a FQCN (fully qualified class name).  This is passed into the
LoggingEvent and in turn to LocationInfo.  The magic of the stack trace
read is done in the constructor.  I've successfully moved the entry point
up the stack trace by passing a different FQCN to the generic method:
 public void log(String callerFQCN, Priority level, Object message,
Throwable t)
In this sense, I suppose that the place in the callstack is configurable.

Hope this helps.

Sincerely,
John Hiltenbrand



From:   Adam Crain <[email protected]>
To:     [email protected]
Date:   02/25/2011 08:57 AM
Subject:        file/method/class location information



Hi,

Would someone point me to where log4j determines call location info? I'm
expecting to find something like:

Thread.currentThread().getStackTrace()[2].getLineNumber()


Is the place in the callstack configurable? I'm trying to write a Scala
wrapper to SLF4J that uses a Log4j backend, and I'd like to shift the
localization when level up in the callstack.

best,
Adam

--

*Adam Crain*

Chief Platform Architect, GEC

Office: 919.836.9916

Cell:  919.428.1002

[email protected] <[email protected]>


*Green Energy Corp,* *enabling the smart grid of the future.**   *

*www.greenenergycorp.com*

*www.totalgrid.org*

Reply via email to