Lingchao Chen created SLF4J-478: ----------------------------------- Summary: Updating from 1.7.25 to 2.0.0-alpha1 breaks Key: SLF4J-478 URL: https://jira.qos.ch/browse/SLF4J-478 Project: SLF4J Issue Type: Bug Reporter: Lingchao Chen Assignee: SLF4J developers list
When I try to upgrade sl4j-api from 1.7.25 to version 1.8.X and 2.X. The following code breaks. {code:java} public class TestSl4j extends AbstractTest4StdOut { @Test public void demo() throws Exception{ final Logger logger = LoggerFactory.getLogger(TestSl4j.class); // Log in Main Thread logger.info("Log in main!"); assertEquals("[] {} - Log in main!", getLogAndClear()); } } public abstract class AbstractTest4StdOut { @Rule public final SystemOutRule systemOutRule = new SystemOutRule().enableLog(); protected static final long START_TIME_STAMP = System.currentTimeMillis(); protected String getLogAndClear() { System.out.flush(); final String out = systemOutRule.getLog(); systemOutRule.clearLog(); final int idx = out.indexOf('\n'); return out.substring(idx + 1, out.length() - 1); // trim first line and last '\n' } } {code} The code should pass, but it throws an error: {code:java} [ERROR] demo(TestSl4j) Time elapsed: 0.018 s <<< ERROR! java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at demo(TestSl4j.java:19) {code} -- This message was sent by Atlassian JIRA (v7.3.1#73012) _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev