<div dir="ltr">It looks like this is a bug: <a href="https://github.com/qos-ch/slf4j/pull/166">https://github.com/qos-ch/slf4j/pull/166</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 11:27 AM, Daniel Trebbien <span dir="ltr"><<a href="mailto:dtrebbien@gmail.com" target="_blank">dtrebbien@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I have noticed an inconsistency in behavior of the following logging code:</div><div><br></div><div><div><font face="monospace, monospace"> final Throwable t = new RuntimeException("some runtime exception");</font></div><div><font face="monospace, monospace"> LOGGER.info("{} {} {}", new Object[] { "abc", "def", t });</font></div><div><font face="monospace, monospace"> LOGGER.info("{} {}", "abc", t);</font></div><div><font face="monospace, monospace"> LOGGER.info("{}", (Object) t);</font></div></div><div><br></div><div>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:</div><div><br></div><div><div><font face="monospace, monospace">[main] INFO test.Main - abc def java.lang.RuntimeException: some runtime exception</font></div><div><font face="monospace, monospace">[main] INFO test.Main - abc java.lang.RuntimeException: some runtime exception</font></div><div><font face="monospace, monospace">[main] INFO test.Main - java.lang.RuntimeException: some runtime exception</font></div></div><div><br></div><div>In SLF4J versions 1.7.15 and newer (tested 1.7.15 and 1.7.25), the result is:</div><div><br></div><div><div><font face="monospace, monospace">[main] INFO test.Main - abc def {}</font></div><div><font face="monospace, monospace">java.lang.RuntimeException: some runtime exception</font></div><div><font face="monospace, monospace"><span class="m_-8134838260662705788gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>at test.Main.main(Main.java:10)</font></div><div><font face="monospace, monospace">[main] INFO test.Main - abc {}</font></div><div><font face="monospace, monospace">java.lang.RuntimeException: some runtime exception</font></div><div><font face="monospace, monospace"><span class="m_-8134838260662705788gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>at test.Main.main(Main.java:10)</font></div><div><font face="monospace, monospace">[main] INFO test.Main - java.lang.RuntimeException: some runtime exception</font></div></div><div><br></div><div><br></div><div>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.</div><div><br></div><div>Is this a bug?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Daniel Trebbien</div></font></span></div>
</blockquote></div><br></div>