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 <dtrebb...@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 >
_______________________________________________ slf4j-user mailing list slf4j-user@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-user