This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch issue/fix-build in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
commit c6f229e8140f23c32c7b5f88a754e344e02fbf37 Author: Rishabh Kumar <[email protected]> AuthorDate: Thu Jul 23 22:59:30 2026 +0530 SLING-13270 : fix flaky OsgiConfiguratorTest by reloading logback.xml explicitly --- .../sling/commons/log/json/impl/OsgiConfiguratorTest.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/json-logs/org.apache.sling.commons.log.json/src/test/java/org/apache/sling/commons/log/json/impl/OsgiConfiguratorTest.java b/json-logs/org.apache.sling.commons.log.json/src/test/java/org/apache/sling/commons/log/json/impl/OsgiConfiguratorTest.java index 4ca0c136..e4d0bcbd 100644 --- a/json-logs/org.apache.sling.commons.log.json/src/test/java/org/apache/sling/commons/log/json/impl/OsgiConfiguratorTest.java +++ b/json-logs/org.apache.sling.commons.log.json/src/test/java/org/apache/sling/commons/log/json/impl/OsgiConfiguratorTest.java @@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.joran.JoranConfigurator; public class OsgiConfiguratorTest { @@ -43,8 +44,15 @@ public class OsgiConfiguratorTest { public final OsgiContext context = new OsgiContext(); @Before - public void init() { + public void init() throws Exception { + // reset and reload the logback.xml test config explicitly: another test class + // may have already reset the LoggerContext, wiping out the "console" appender + // that this test's rootLogger.getAppender(...) lookup depends on LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); + loggerContext.reset(); + JoranConfigurator configurator = new JoranConfigurator(); + configurator.setContext(loggerContext); + configurator.doConfigure(getClass().getResource("/logback.xml")); loggerContext.start(); }
