SNOW-3211195 Implement bridge from shaded slf4j to SFLogger#2543
Merged
Conversation
d5214d2 to
df1ae2c
Compare
sfc-gh-boler
approved these changes
Mar 9, 2026
Contributor
There was a problem hiding this comment.
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 toSFLoggerFactory, plus the corresponding SPI service file. - Updated Maven build configuration (both
pom.xmlandFIPS/pom.xml) to shadeorg.slf4j, include the fat-jar-specific sources/resources, and copy back the unshadedSLF4JLogger.classpost-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.
sfc-gh-merbel
approved these changes
Mar 9, 2026
sfc-gh-dheyman
requested changes
Mar 9, 2026
sfc-gh-dheyman
approved these changes
Mar 9, 2026
0b1ab5e to
da828f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the bridge from shaded slf4j (used by AWS, GCP, Azure and other libraries) to our own SFLogger.
compilescope 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.SFLoggerSLF4JLoggerto fat, because we want it to use the original, client slf4j, and not our shaded version.