Skip to content

Commit

Permalink
adapt test to SLF4J version 2.0.16
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <ceki@qos.ch>
  • Loading branch information
ceki committed Jan 5, 2025
1 parent cb60369 commit 8935470
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,27 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.slf4j.helpers.Reporter.SLF4J_INTERNAL_VERBOSITY_KEY;

public class InvocationTest {

private final PrintStream oldErr = System.err;
final String loggerName = this.getClass().getName();
StringPrintStream sps = new StringPrintStream(oldErr, true);

String CONNECTED_WITH_MESSAGE = "SLF4J(I): Connected with provider of type [ch.qos.logback.classic.spi.LogbackServiceProvider]";
String CONNECTED_WITH_MESSAGE = "SLF4J(D): Connected with provider of type [ch.qos.logback.classic.spi.LogbackServiceProvider]";

@BeforeEach
public void setUp() throws Exception {
System.setProperty(SLF4J_INTERNAL_VERBOSITY_KEY, "debug");
System.setErr(sps);
}

@AfterEach
public void tearDown() throws Exception {
LoggerFactoryFriend.reset();
System.setErr(oldErr);
System.clearProperty(SLF4J_INTERNAL_VERBOSITY_KEY);
}

// https://jira.qos.ch/browse/LOGBACK-1568 would have been prevented
Expand Down

0 comments on commit 8935470

Please sign in to comment.