[slf4j-dev] Beta 4 and the new method signatures

Ceki Gülcü listid at qos.ch
Thu Jul 7 21:32:56 CEST 2005


At 07:54 AM 7/7/2005, Christian Stein wrote:
>Hello Ceki, Niklas and all others!
>
>I'm totally with Niklas - especially in two issues. First the strong typing of
>the 'message' and 'format' argument as String. And second, his proposal of the
>generic 'log(LEVEL, message...)' methods. Nice to see the first issue
>implemented in the current version of SLF4J, already. Is the 'log(...)' 
>feature
>  a no-go, Ceki?

The log(Level, ...) method requires that Level class be defined in
SLF4J. But introducing Level as a class would be an important change
to the scope of the SLF4J project.

SLF4J could define Level as an *interface* which raises the question
of construction of Level instances. Admittedly, Marker suffers from
the exact same problem.

Does this answer your question?

>Another question. In the message 
>http://svn.slf4j.org/viewcvs?rev=82&view=rev of
>the SVN log, you write about 5 debug methods. Namely:
>
>(cg1)  debug(String msg);
>(cg2)  debug(String msg, Throwable t);
>(cg3)  debug(String format, Object arg);
>(cg4)  debug(String format, Object arg, Object arg2);
>(cg5)  debug(String format, Object[] args);
>
>In revision 95 of Logger.java I miss (cg5) - or is it covered by (cg3)?
>
>Is (cg4) a "short cut" for (cg5)? Does it "virtually" expand to:
>   debug(format, new Object[] {arg, arg2});

No, (cg4) is not a shortcut. It is handled separately than the single
arg variant. The method (cg5) is missing because there is no
parsing code to back it up. I think that such code will eventually be added
for the sake of completeness.

>Hmm, I didn't read the documentation too carefully, but if the target platform
>were Java5, you could merge (cg3..5) into one method. Something like:
>
>(cs1)  debug(String format, Object... arguments);
>
>But this feature might be only interesting in, say SLF5J... *hehe*

The vararg feature requires 1.5 whereas SLF4J aims to be JDK neutral.

>Anyway, I really like the "new cloth" of Log4J and hope that many projects 
>will
>carefully re-think about usage of JCL. Keep up the excellent work!

Thanks Christian. You should be aware that there are no guarantees
that log4j will adhere to the org.slf4j.Logger interface. Some day it
may, and in the meantime there is nlog4j.

>Cheers,
>Christian
>_______________________________________________

-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/





More information about the slf4j-dev mailing list