This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new c509db8e json-logs: build fixes for Jenkins (#129)
c509db8e is described below
commit c509db8e62274952e981efe3e629e96f3fbbb9b9
Author: Robert Munteanu <[email protected]>
AuthorDate: Mon Jul 27 15:36:07 2026 +0200
json-logs: build fixes for Jenkins (#129)
* SLING-13270 : fix flaky OsgiConfiguratorTest by reloading logback.xml
explicitly
* SLING-13270 : fix LoggerPrinterTest flakiness on windows by using
platform line separator
Co-Authored-By: Claude Sonnet 5 <[email protected]>
---------
Co-authored-by: Rishabh Kumar <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
---
.../org/apache/sling/commons/log/json/impl/LoggerPrinter.java | 5 +++--
.../sling/commons/log/json/impl/OsgiConfiguratorTest.java | 10 +++++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git
a/json-logs/org.apache.sling.commons.log.json/src/main/java/org/apache/sling/commons/log/json/impl/LoggerPrinter.java
b/json-logs/org.apache.sling.commons.log.json/src/main/java/org/apache/sling/commons/log/json/impl/LoggerPrinter.java
index eb71851d..18023245 100644
---
a/json-logs/org.apache.sling.commons.log.json/src/main/java/org/apache/sling/commons/log/json/impl/LoggerPrinter.java
+++
b/json-logs/org.apache.sling.commons.log.json/src/main/java/org/apache/sling/commons/log/json/impl/LoggerPrinter.java
@@ -58,7 +58,8 @@ public class LoggerPrinter extends BasicStatusManager {
}
private void renderHeader(PrintWriter pw, String header) {
- pw.println("\n\n" + header + "\n-------------------\n");
+ String nl = System.lineSeparator();
+ pw.println(nl + nl + header + nl + "-------------------" + nl);
}
private String statusToString(Status status) {
@@ -74,7 +75,7 @@ public class LoggerPrinter extends BasicStatusManager {
*/
public void printConfiguration(PrintWriter pw) {
- pw.println(HEADLINE + "\n===========================");
+ pw.println(HEADLINE + System.lineSeparator() +
"===========================");
renderHeader(pw, "Status");
this.getCopyOfStatusList().stream().map(this::statusToString).forEach(pw::println);
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();
}