fix: resolve SLF4J and Logback compatibility issues#768
fix: resolve SLF4J and Logback compatibility issues#768GOODBOY008 wants to merge 1 commit intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses SLF4J and Logback compatibility issues by removing the slf4j-simple binding in favor of logback-classic and fixing Logback configuration files to remove Spring Boot-specific elements that are not supported in standard Logback.
Key changes:
- Removed
slf4j-simpledependency and its version property from the parent POM - Downgraded
logback-classicversion from 1.5.23 to 1.2.13 - Updated
fesod-sheettest logback configuration to use standard Logback properties instead of Spring Boot includes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pom.xml | Removed slf4j-simple dependency and version property, downgraded logback-classic version to 1.2.13, and removed slf4j-simple from parent dependencies |
| fesod-sheet/src/test/resources/logback.xml | Replaced Spring Boot logback include with standard property definition and changed root log level from DEBUG to INFO |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fb318b3 to
e130906
Compare
|
why not upgrade to slf4j 2.x ? |
|
@alaahong It’s fine for me to upgrade SLF4J to 2.x, as long as we can reach a consensus.Considered both options—upgrading SLF4J and staying with SLF4J 1.7.x. To minimize risk and scope of change, I chose the minimal-change approach by downgrading logback-classic. Issue:Compatibility Issue
Redundant Issue
Log output in console (Before)
Log output in console (Remove slf4j-simple)
Log output in console (Apply the current pr)
|
c1edafc to
f5cae74
Compare
|
@alaahong PR updated. SLF4J has been upgraded to 2.x, and logback-classic has been downgraded to 1.3.x to maintain Java 8 compatibility.
Reference:Java Logging Part 2: Logging and Package Exclusion with SLF4J + Logback |
f5cae74 to
1edbfb4
Compare
1edbfb4 to
a942370
Compare
|
@delei PTAL,If you have time, Thank you~ |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <artifactId>logback-classic</artifactId> | ||
| <version>1.2.13</version> | ||
| <scope>test</scope> | ||
| </dependency> |
There was a problem hiding this comment.
This module explicitly uses Logback 1.2.13 which requires SLF4J 1.7.x, but the parent POM now defines slf4j-api.version as 2.0.17 (line 73 in parent pom.xml). This creates a version conflict:
- Logback 1.2.13 depends on SLF4J 1.7.x
- Parent POM declares SLF4J 2.0.17
Since this module excludes slf4j-api from spring-boot-starter-web (line 52-54) and relies on the parent's SLF4J version, there will be a runtime incompatibility. Either:
- Keep Logback 1.2.13 and explicitly declare slf4j-api 1.7.36 as a dependency in this module, OR
- Upgrade to Logback 1.3.14 to match the parent POM's SLF4J 2.0.17 (but note this may conflict with Spring Boot 2.7.18's expectations)
| </dependency> | |
| </dependency> | |
| <!-- Explicitly use SLF4J 1.7.x to match Logback 1.2.13 and avoid SLF4J 2.0.x from parent --> | |
| <dependency> | |
| <groupId>org.slf4j</groupId> | |
| <artifactId>slf4j-api</artifactId> | |
| <version>1.7.36</version> | |
| <scope>test</scope> | |
| </dependency> |
| </exclusion> | ||
| </exclusions> | ||
| </dependency> | ||
| <!-- Use Logback 1.2.x with SLF4J 1.7.x for Spring Boot 2.7.x compatibility --> |
There was a problem hiding this comment.
The comment states "Use Logback 1.2.x with SLF4J 1.7.x for Spring Boot 2.7.x compatibility" but the parent POM (line 73) now declares slf4j-api version 2.0.17, not 1.7.x. Since this module excludes slf4j-api from spring-boot-starter-web and doesn't explicitly declare its own slf4j-api dependency, it will inherit version 2.0.17 from the parent, making the comment inaccurate. Either update the comment to reflect the actual configuration or add an explicit slf4j-api 1.7.36 dependency to match the comment's intent.
| <!-- Use Logback 1.2.x with SLF4J 1.7.x for Spring Boot 2.7.x compatibility --> | |
| <!-- Use Logback 1.2.x; SLF4J version is inherited from the parent POM (currently 2.0.17) --> |




Summary
This PR fixes the compatibility issue between logback-classic and slf4j-api, and removes the erroneous Spring Boot configuration from logback.xml.
Changes
1. Update logback-classic version (pom.xml)
2. Update slf4j-api version (pom.xml)
3. Replace log bridging dependencies (pom.xml)
4. Fix logback.xml configuration
Compatibility Matrix