Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
1.1.3
-
None
Description
This issue reports on a regression introduced in 1.1.*. In 1.0.13 the following test program:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Test
{
private static final Logger LOGGER = LoggerFactory.getLogger(Test.class);
public static void main(String[] args)
{
LOGGER.warn("foo {} {}", "bla", new Exception("bar"));
}
}
logs
11:45:29.278 [main] WARN Test - foo bla java.lang.Exception: bar
In 1.1.1 the same program logs:
11:46:03.664 [main] WARN Test - foo bla {}
java.lang.Exception: bar
at Test.main(Test.java:14) [tmp/:na]
Thus in 1.1.1 logback unconditionally removes the exception from the argument array and logs the stack trace despite there being a placeholder for it in the pattern.
Since SLF4J has a special method for the case of logging an exception (Logger#warn(String,Throwable)), I would expect the the behavior observed with 1.0.* to be the correct one.