[slf4j-user] Varargs for Logger methods

Kostis Anagnostopoulos ankostis at gmail.com
Mon Oct 16 06:23:56 CEST 2006


Hi,

since you are revisiting the varargs issue, please consider the
'throwable' argument's postion. See
http://www.slf4j.org/pipermail/user/2006-February/000062.html
for an older discussion with Ceki.

In a nutshell, there is a problem if the current API extends to
combine message arguments with exception.  For intance, the following
invocation is problematic:
    error("All {} are {}.", ex, "children", "sleeping");

Regards,
  Kostis


On 10/15/06, Ceki Gülcü <listid at qos.ch> wrote:
> Hello Martin,
>
> JDK 1.5 vargs support in org.slf4j.Logger class methods is one of the
> most frequently requested features. However, since SLF4J is intended
> to be compatible JDK 1.2 and above, we cannot add vargs support
> without breaking compatibility with older JDK's.
>
> Some of our users expect SLF4J to be JDK 1.4 compatible. It
> would be quite inappropriate to pull the rug under their feet.
>
> However, if there is a way to preserve compatibility with existing
> clients (both compile time and run time), then I'd be glad add vararg
> support to SLF4J. In practice see [1], this means that we would need two
> versions of slf4j-API.jar, one targeting JDK 1.4 and one targeting JDK
> 1.5. If you care to submit a bug report, I'll be happy to revisit this
> issue closely before 1.1 final is released.
>
> As for vararg support in logback, since logback is a native
> implementation of SLF4J, if SLF4J API does not have it, then nor will
> logback. It is also true that if SLF4J has it, so will logback.
>
> [1] http://marc.theaimsgroup.com/?t=114004841000007&r=1&w=2
>
> At 05:30 PM 10/14/2006, Martin Gilday wrote:
> >Hi,
> >I have just been evaluating SLFJ, looking to move over from JCL.  I was
> >pleased to come across the conveience log statements that reduce the
> >need for isDebugEnabled if statements. My immediate reaction to this was
> >that it would be a great place to use varargs.  Searching this mailing
> >list showed that this had been discussed before, with the outcome that
> >it would not be added at the present time.  Has there been any more
> >thought given to integrating vararg support?  Alternatively has any side
> >projects or extensions been produced that do this for log4j/logback?
> >
> >Thanks,
> >Martin Gilday.
>
> --
> Ceki Gülcü
> Logback: The reliable, generic, fast and flexible logging framework for Java.
> http://logback.qos.ch
>
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://www.slf4j.org/mailman/listinfo/user
>



More information about the slf4j-user mailing list