[slf4j-user] What about providing LoggerFactory.getLogger() method?
Ceki Gülcü
listid at qos.ch
Wed Oct 26 12:14:05 CEST 2005
Hello Trustin,
I think it is a great idea. When you say it would be easy in case of
JDK 1.4, are you thinking of the Throwable.fillInStackTrace() method
introduced in JDK 1.4? The javadoc for that method states:
Some virtual machines may, under some circumstances, omit one or
more stack frames from the stack trace. In the extreme case, a virtual
machine that has no stack trace information concerning this throwable
is permitted to return a zero-length array from this method. Generally
speaking, the array returned by this method will contain one element
for every frame that would be printed by printStackTrace.
If the said "omitted stack frame" is the one identifying the caller,
then the logger name computed by LoggerFactory.getLogger() would be
wrong, with potentially very unpleasant results. :-)
Would you concur?
At 01:43 AM 10/26/2005, you wrote:
>Hi,
>
>Logging framework users usually creates a logger per-class basis like this:
>
>class <ClassName> {
> private static final Logger log = LoggerFactory.getLogger(
> <ClassName>.class );
>...
>}
>
>So it would be great if SLF4J provide LoggerFactory.getLogger() which
>returns a Logger whose name is the same with the FQCN of the caller
>class. It should be very easy in case of JDK 1.4 and be not that hard in
>JDK 1.2 and 1.3, either. WDYT?
>
>Trustin
>--
>what we call human nature is actually human habit
>--
><http://gleamynode.net/>http://gleamynode.net/
--
Ceki Gülcü
The complete log4j manual: http://www.qos.ch/log4j/
Improve your Sudoku skills at http://www.sudoku-grok.com/
More information about the slf4j-user
mailing list