Skip to content

SNOW-3211195 Implement bridge from shaded slf4j to SFLogger#2543

Merged
sfc-gh-pfus merged 3 commits into
masterfrom
SNOW-3211195-slf4j-bridge
Mar 9, 2026
Merged

SNOW-3211195 Implement bridge from shaded slf4j to SFLogger#2543
sfc-gh-pfus merged 3 commits into
masterfrom
SNOW-3211195-slf4j-bridge

Conversation

@sfc-gh-pfus

@sfc-gh-pfus sfc-gh-pfus commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

This PR implements the bridge from shaded slf4j (used by AWS, GCP, Azure and other libraries) to our own SFLogger.

  1. slf4j-api is now a compile scope dependency. In the thin jar ,it just forces SLF4J to be present in the final classpath. In the fat jar, it is shaded. Mentioned, shaded dependencies use this shaded SLF4J regardless of JUL or SLF4J used by the target client.
  2. Additional classes are added for fat-jar only - they are bridging SLF4J used by internal, shaded dependencies to SFLogger
  3. After shading slf4j, we have to "recopy" original SLF4JLogger to fat, because we want it to use the original, client slf4j, and not our shaded version.

@sfc-gh-pfus sfc-gh-pfus force-pushed the SNOW-3211195-slf4j-bridge branch 8 times, most recently from d5214d2 to df1ae2c Compare March 9, 2026 07:16
@sfc-gh-pfus sfc-gh-pfus marked this pull request as ready for review March 9, 2026 07:30
@sfc-gh-pfus sfc-gh-pfus requested a review from a team as a code owner March 9, 2026 07:30
@sfc-gh-pfus sfc-gh-pfus requested a review from Copilot March 9, 2026 08:10

Copilot AI left a comment

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.

Pull request overview

This PR implements a bridge from shaded SLF4J (used internally by AWS SDK v2, Azure SDK, and Google Cloud SDK) to the Snowflake JDBC driver's own SFLogger abstraction. This ensures that logging from third-party dependencies embedded in the fat jar flows through the driver's logging framework (either JUL by default or the user's SLF4J binding when opted in), rather than being silently discarded or conflicting with the user's SLF4J setup.

Changes:

  • Added new fat-jar-only classes (SFBridgeServiceProvider, SFBridgeLoggerFactory, SFBridgeLogger) that implement the SLF4J SPI to bridge shaded SLF4J calls to SFLoggerFactory, plus the corresponding SPI service file.
  • Updated Maven build configuration (both pom.xml and FIPS/pom.xml) to shade org.slf4j, include the fat-jar-specific sources/resources, and copy back the unshaded SLF4JLogger.class post-shading so it references the user's real SLF4J.
  • Enhanced the fat-jar test app and CI workflow to verify logging works correctly in both JUL and SLF4J modes, including log output verification for cloud SDK logger names.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main/java-fat-jar/.../SFBridgeServiceProvider.java New SLF4J SPI provider that bootstraps the bridge logger factory for shaded SLF4J
src/main/java-fat-jar/.../SFBridgeLoggerFactory.java New ILoggerFactory that creates cached SFBridgeLogger instances
src/main/java-fat-jar/.../SFBridgeLogger.java New SLF4J Logger that delegates all logging calls to SFLogger via SFLoggerFactory
src/main/resources-fat-jar/.../org.slf4j.spi.SLF4JServiceProvider SPI service file registering the bridge provider for the shaded SLF4J
pom.xml Adds SLF4J shading relocation, fat-jar source/resource directories, and post-shade class copy
FIPS/pom.xml Mirrors the same shading and build changes for the FIPS fat jar variant
parent-pom.xml Changes slf4j-api scope from provided to compile
fat-jar-test-app/src/main/java/.../FatJarTestApp.java Adds logging setup and verification logic for both JUL and SLF4J modes
fat-jar-test-app/pom.xml Adds SLF4J profile with logback dependencies, simplifies classpath management
fat-jar-test-app/run.sh Adds logging mode parameter support (slf4j/jul)
fat-jar-test-app/src/main/resources/logging.properties JUL configuration for the test app
fat-jar-test-app/src/main/resources/logback.xml Logback configuration for the SLF4J test mode
.github/workflows/build-test.yml Splits fat jar CI into separate SLF4J (all clouds) and JUL (AWS only) test jobs
CHANGELOG.md Documents the new SLF4J bridge feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/build-test.yml
Comment thread fat-jar-test-app/src/main/java/net/snowflake/FatJarTestApp.java Outdated
Comment thread parent-pom.xml
@sfc-gh-pfus sfc-gh-pfus force-pushed the SNOW-3211195-slf4j-bridge branch from 0b1ab5e to da828f6 Compare March 9, 2026 13:01
@sfc-gh-pfus sfc-gh-pfus merged commit c6ce571 into master Mar 9, 2026
296 of 308 checks passed
@sfc-gh-pfus sfc-gh-pfus deleted the SNOW-3211195-slf4j-bridge branch March 9, 2026 20:17
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants