[slf4j-user] What about providing LoggerFactory.getLogger() method?
Trustin Lee
trustin at gmail.com
Wed Oct 26 13:10:28 CEST 2005
Hello Ceki,
2005/10/26, Ceki Gülcü <listid at qos.ch>:
>
> 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?
It seems like the quoted documentation is for 'getStackTrace()' method. :)
Anyway, you're right. But what about parsing stack trace strings to find out
the class name? This should work for most virtual machines. In case of
failure we could throw a RuntimeException to trigger
ExceptionInitializerError.
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20051026/5c35d369/attachment.htm>
More information about the slf4j-user
mailing list