Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ jobs:
- name: Build
# executing ITs requires installing artifacts to the local repository
run: mvn -B ${{ env.MVN_GOAL }} ${{ env.MVN_ADDITIONAL_OPTS }} -Pcoverage,integrationTesting,javadoc -Dnsfixtures=SEGMENT_TAR,DOCUMENT_NS
- name: Test SLF4J 2.0 compatibility
# Reuse the SLF4J 1.7-built library classes; do not recompile against the modern API.
run: >-
mvn -B initialize surefire:test -Pslf4j-2.0
-Dtest=SystemPropertySupplierTest,LogCustomizerTest,TreeTest,LoggingDocumentStoreWrapperTest,LoggingHookTest,AzureHttpRequestLoggingPolicyTest,AzureHttpRequestLoggingPolicyV12Test,LuceneDocumentMakerLargeStringPropertiesLogTest,ElasticDocumentMakerLargeStringPropertiesLogTest
-Dsurefire.failIfNoSpecifiedTests=false
- name: Test embedded logging with SLF4J 1.7
run: >-
mvn -B verify -pl oak-it-osgi -PintegrationTesting
-Dit.test=OSGiIT#slf4jImportRanges+cloudSlf4jImports+embeddedSlf4jLogging
-Dslf4j.api.version=1.7.36 -Dlogback.version=1.2.13
- name: Upload build result
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions oak-benchmarks-elastic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<artifactId>oak-benchmarks-elastic</artifactId>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<skip.deployment>true</skip.deployment>
</properties>

Expand Down
2 changes: 2 additions & 0 deletions oak-benchmarks-lucene/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<artifactId>oak-benchmarks-lucene</artifactId>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<skip.deployment>true</skip.deployment>
</properties>

Expand Down
2 changes: 2 additions & 0 deletions oak-benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<name>Oak Benchmarks Runner</name>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<skip.deployment>true</skip.deployment>
</properties>

Expand Down
2 changes: 2 additions & 0 deletions oak-blob-cloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

<!-- SLF4J -->
org.slf4j;version="[1.7,2)",
<!-- Embedded AWS SDK uses the Level API shared by both generations. -->
org.slf4j.event;version="[1.7,3)",

<!-- AWS SDK CRT (truly optional - only needed for CRT HTTP client) -->
software.amazon.awssdk.crt;resolution:=optional,
Expand Down
2 changes: 2 additions & 0 deletions oak-examples/standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<description>Standalone application based on Spring Boot then embeds a Jackrabbit Oak content repository</description>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<skip.deployment>true</skip.deployment>
<spring.boot.version>2.7.18</spring.boot.version>
</properties>
Expand Down
2 changes: 2 additions & 0 deletions oak-examples/webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
<description>Web application that hosts and serves a Jackrabbit Oak content repository</description>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<tomcat.version>9.0.118</tomcat.version>
<skip.deployment>true</skip.deployment>
</properties>
Expand Down
2 changes: 2 additions & 0 deletions oak-it-osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<name>Oak Integration Tests for OSGi deployments</name>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<skip.deployment>true</skip.deployment>
</properties>

Expand Down
239 changes: 238 additions & 1 deletion oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions oak-it-osgi/test-bundles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>cloud</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping>
<scope>test</scope>
<includes>
<include>org.apache.jackrabbit:oak-blob-cloud</include>
</includes>
<useTransitiveDependencies>false</useTransitiveDependencies>
</dependencySet>
<dependencySet>
<outputDirectory/>
<outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping>
Expand Down
23 changes: 16 additions & 7 deletions oak-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@
<segment.db>SegmentMK</segment.db>
<lucene.version>4.7.2</lucene.version>
<mongo.driver.version>5.5.2</mongo.driver.version>
<slf4j.api.version>2.0.20</slf4j.api.version>
<slf4j.version>2.0.20</slf4j.version> <!-- sync with logback version -->
<logback.version>1.6.4</logback.version>
<slf4j.api.version>1.7.36</slf4j.api.version>
<slf4j.version>2.0.20</slf4j.version> <!-- sync with logback.runtime.version -->
<logback.version>1.2.13</logback.version> <!-- library test backend -->
<logback.runtime.version>1.6.4</logback.runtime.version>
<h2.version>2.1.214</h2.version>
<tika.version>1.28.5</tika.version>
<derby.version>10.16.1.1</derby.version>
Expand Down Expand Up @@ -599,22 +600,22 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<version>${slf4j.api.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<version>${slf4j.api.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
<version>${slf4j.api.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
<version>${slf4j.api.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down Expand Up @@ -947,6 +948,14 @@
</dependencyManagement>

<profiles>
<!-- Runtime compatibility checks only; compile library classes against the default 1.7 API. -->
<profile>
<id>slf4j-2.0</id>
<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
</properties>
</profile>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Unit testing profiles -->
<profile>
<id>unittesting</id>
Expand Down
5 changes: 5 additions & 0 deletions oak-run-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<artifactId>oak-run-commons</artifactId>
<name>Oak Commons for Runnable modules</name>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
</properties>

<build>
<plugins>
<plugin>
Expand Down
2 changes: 2 additions & 0 deletions oak-run-elastic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<name>Oak Elastic Runnable Jar</name>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<jetty.version>8.2.0.v20160908</jetty.version>
<!--
Size History:
Expand Down
2 changes: 2 additions & 0 deletions oak-run/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<name>Oak Runnable Jar</name>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
<jetty.version>9.4.53.v20231009</jetty.version>
<!--
Size History:
Expand Down
2 changes: 2 additions & 0 deletions oak-search-elastic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
org.apache.jackrabbit.oak.plugins.index.elastic.util
</Export-Package>
<Import-Package>
<!-- Embedding regenerates imports; preserve Commons Logging's declared SPI range. -->
org.slf4j.spi;version="[1.7,3)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This increased import range I consider still wrong. The default one from Bnd is correct and SLF4J still exports package version 1.x.

@rishabhdaim rishabhdaim Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the generated manifests and ran the OSGi tests with and without the override.

With SLF4J 1.7.36, bnd 6.3.1 generates org.slf4j.spi;version="[1.7,2)" by default.

SLF4J 2.0.20 exports org.slf4j.spi only at version 2.0.20.
Its additional 1.7.36 compatibility exports cover org.slf4j and org.slf4j.helpers, but not org.slf4j.spi.

See SLF4J’s export configuration.

Without the override, bnd generates [1.7,2), which rejects SLF4J 2.0’s SPI package.

I reproduced the resulting LocationAwareLogger loading failure; restoring [1.7,3) made the tests pass.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

org.slf4j.spi is not backwards compatible, only org.slf4j. Widening the import version range doesn't make it magically backwards compatible either. That the test don't run into issues probably just proofs that they are not complete. See discussion at qos-ch/slf4j#358 and https://jira.qos.ch/browse/SLF4J-579.
Particularly pay attention to

The package-info for org.slf4j.spi states that this package should not be used by clients.

@rishabhdaim rishabhdaim Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that SLF4J does not guarantee compatibility for the entire SPI package; this exception preserves the embedded Commons Logging 1.3.5 bundle's own optional [1.7,3) SPI import.

In 110fe7d0c0, I clarified the POM comment and changed the test to use LogFactory.getLog with the real OSGi provider, checking enabled/disabled levels, throwable identity and caller location: all 9 OSGi tests pass on both SLF4J 1.7.36 / Logback 1.2.13 and SLF4J 2.0.20 / Logback 1.6.4, while removing the override reproduces two LocationAwareLogger loading errors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so commons-logging itself has a widened import range there, no problem. The AWS SDK apparently only uses org.slf4j.event.Level without calling any 2.x-specific methods, so it will work de facto with the widened range (and apparently it used to work in Oak with 1.x in the past and 2.x now), so I guess we can do this. But I'd really prefer if we keep this temporary and go fully 2.x ASAP.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbaedke, yes, the goal is that this is a temporary arrangement, and we would probably remove the support for 1.x in future releases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwin @mbaedke if the changes looks fine, can we go ahead and merge this PR now ?

!com.ibm.*, <!-- see OAK-11076 -->
!org.apache.derby.*, <!-- see OAK-11076 -->
!io.opentelemetry.sdk.autoconfigure.*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ protected static Option logging(String level) {
return composite(
mavenBundle("org.ops4j.pax.logging", "pax-logging-api", "1.11.13"),
SlingOptions.spyfly(),
mavenBundle("org.slf4j", "slf4j-api", "2.0.12"),
mavenBundle("org.slf4j", "slf4j-simple", "2.0.12"),
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(level),
SlingOptions.logback()
);
Expand Down
5 changes: 5 additions & 0 deletions oak-upgrade/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<name>Oak upgrade</name>
<description>Tooling for upgrading Jackrabbit repositories to Oak</description>

<properties>
<slf4j.api.version>${slf4j.version}</slf4j.api.version>
<logback.version>${logback.runtime.version}</logback.version>
</properties>

<build>
<plugins>
<plugin>
Expand Down
Loading