[slf4j-user] Inconsistent behavior introduced in SLF4J version 1.7.15
Daniel Trebbien
dtrebbien at gmail.com
Wed Aug 2 20:37:24 CEST 2017
It looks like this is a bug: https://github.com/qos-ch/slf4j/pull/166
On Wed, Aug 2, 2017 at 11:27 AM, Daniel Trebbien <dtrebbien at gmail.com>
wrote:
> Hello,
>
> I have noticed an inconsistency in behavior of the following logging code:
>
> final Throwable t = new RuntimeException("some runtime exception");
> LOGGER.info("{} {} {}", new Object[] { "abc", "def", t });
> LOGGER.info("{} {}", "abc", t);
> LOGGER.info("{}", (Object) t);
>
> In SLF4J versions 1.7.14 and earlier (tested 1.7.14, 1.7.13, 1.7.10,
> 1.7.7, 1.7.0, and 1.6.0), the result using the "simple" backend is:
>
> [main] INFO test.Main - abc def java.lang.RuntimeException: some runtime
> exception
> [main] INFO test.Main - abc java.lang.RuntimeException: some runtime
> exception
> [main] INFO test.Main - java.lang.RuntimeException: some runtime exception
>
> In SLF4J versions 1.7.15 and newer (tested 1.7.15 and 1.7.25), the result
> is:
>
> [main] INFO test.Main - abc def {}
> java.lang.RuntimeException: some runtime exception
> at test.Main.main(Main.java:10)
> [main] INFO test.Main - abc {}
> java.lang.RuntimeException: some runtime exception
> at test.Main.main(Main.java:10)
> [main] INFO test.Main - java.lang.RuntimeException: some runtime exception
>
>
> To me, the new behavior is unexpected, and it is inconsistent with the
> logging variant taking exactly one parameter because although the Throwable
> instance is the last parameter, the one and only formatting anchor in the
> format string is replaced by the toString() result and the stack trace is
> not logged.
>
> Is this a bug?
>
> Daniel Trebbien
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20170802/f55bcd43/attachment.html>
More information about the slf4j-user
mailing list