You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fesod.apache.org by "GOODBOY008 (via GitHub)" <gi...@apache.org> on 2025/12/28 12:30:23 UTC
[PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
GOODBOY008 opened a new pull request, #768:
URL: https://github.com/apache/fesod/pull/768
## Summary
This PR fixes compatibility issues between SLF4J and Logback Classic in the test configuration.
## Changes
### 1. Added `logback-classic` dependency to `fesod-sheet` module
- Added `logback-classic` as a test-scoped dependency to provide proper SLF4J binding
- This resolves the "Failed to load class org.slf4j.impl.StaticLoggerBinder" warning
### 2. Cleaned up `logback.xml` configuration
- Removed invalid Spring-specific configuration (`<springProperty>` tag) that is not supported in standard Logback
- The `springProperty` element requires `logback-spring.xml` and Spring Boot environment, which is not available in this test context
- Simplified to use standard Logback `<property>` element instead
## Why these changes are needed
- **SLF4J Compatibility**: SLF4J 1.7.x requires a concrete logging implementation (binding) at runtime. Without `logback-classic`, only the API is available, causing runtime warnings.
- **Logback Configuration**: The `<springProperty>` element is a Spring Boot extension and causes parsing errors when used outside Spring Boot context.
## Testing
These changes ensure that logging works correctly during test execution without any warnings or configuration errors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #768:
URL: https://github.com/apache/fesod/pull/768#issuecomment-3695550452
@alaahong @delei lei PTAL
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #768:
URL: https://github.com/apache/fesod/pull/768#discussion_r2649674649
##########
fesod-sheet/src/test/resources/logback.xml:
##########
@@ -20,7 +20,7 @@
-->
<configuration>
- <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
+ <property name="CONSOLE_LOG_PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"/>
Review Comment:
The fix to remove the Spring Boot specific include for logback defaults is incomplete. While this file has been corrected to use a standard property definition, the file fesod-examples/fesod-sheet-examples/src/test/resources/logback.xml still contains the same problematic Spring Boot include. This should be updated consistently across all modules to avoid the same parsing errors in the examples module.
##########
pom.xml:
##########
@@ -75,10 +75,9 @@
<spring-core.version>5.3.39</spring-core.version>
<fastjson2.version>2.0.60</fastjson2.version>
<spring-boot-starter-web.version>2.7.18</spring-boot-starter-web.version>
- <slf4j-simple.version>1.7.36</slf4j-simple.version>
<jcl-over-slf4j.version>1.7.36</jcl-over-slf4j.version>
<log4j-over-slf4j.version>1.7.36</log4j-over-slf4j.version>
Review Comment:
The logback-classic version has been downgraded from 1.5.23 to 1.2.13. While this older version is compatible with SLF4J 1.7.36, the downgrade should be justified. Version 1.5.x is a significant upgrade with improvements and bug fixes. Consider documenting the reason for this downgrade or using a newer compatible version like 1.4.x series if there are specific compatibility requirements.
```suggestion
<log4j-over-slf4j.version>1.7.36</log4j-over-slf4j.version>
<!--
NOTE: logback-classic 1.4.x/1.5.x require SLF4J 2.x. This project currently uses SLF4J 1.7.36
and Spring Boot 2.7.x, which are aligned with the Logback 1.2.x line. We intentionally pin
logback-classic to 1.2.13 for compatibility, despite it being older than the 1.5.x series.
-->
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #768:
URL: https://github.com/apache/fesod/pull/768#issuecomment-3758676080
@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.
<img width="814" height="304" alt="企业微信截图_f0af6e06-aed4-45a3-915c-e54ef6762122" src="https://github.com/user-attachments/assets/83d2493a-41d2-4672-be1f-d44b18b339bd" />
Reference:
[Java Logging Part 2: Logging and Package Exclusion with SLF4J + Logback
](https://www.alibabacloud.com/blog/development-of-java-logging-part-2-logging-and-package-exclusion-with-slf4j-%2B-logback_601452
)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 closed pull request #768: fix: resolve SLF4J and Logback compatibility issues
URL: https://github.com/apache/fesod/pull/768
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "alaahong (via GitHub)" <gi...@apache.org>.
alaahong commented on PR #768:
URL: https://github.com/apache/fesod/pull/768#issuecomment-3698441921
why not upgrade to slf4j 2.x ?
And meanwhile, can you also attach the screenshot of actual execution log?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #768:
URL: https://github.com/apache/fesod/pull/768#issuecomment-3698595048
@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
- Logback 1.5.x requires SLF4J 2.0.x, but this project uses SLF4J 1.7.36
### Redundant Issue
- The project has both slf4j-simple and logback-classic as test dependencies,slf4j-simple and logback-classic are competing SLF4J implementations
### Log output in console (Before)
<img width="2540" height="984" alt="image" src="https://github.com/user-attachments/assets/dc6b7eba-d8dc-495f-83fc-985f86df9483" />
### Log output in console (Remove slf4j-simple)
<img width="3242" height="740" alt="image" src="https://github.com/user-attachments/assets/070dfa45-1fc4-45c9-800a-da27c91fb40f" />
### Log output in console (Apply the current pr)
<img width="3530" height="1208" alt="image" src="https://github.com/user-attachments/assets/7711e479-00f8-44a4-8eb1-d3d58f8263b5" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #768:
URL: https://github.com/apache/fesod/pull/768#issuecomment-3772025792
@delei PTAL,If you have time, Thank you~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #768:
URL: https://github.com/apache/fesod/pull/768#issuecomment-4022475117
Log component version adjustment changes was merged in pr : https://github.com/apache/fesod/pull/770.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org
Re: [PR] fix: resolve SLF4J and Logback compatibility issues [fesod]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #768:
URL: https://github.com/apache/fesod/pull/768#discussion_r2835923265
##########
fesod-examples/fesod-sheet-examples/pom.xml:
##########
@@ -43,6 +43,23 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- Use Logback 1.2.x with SLF4J 1.7.x for Spring Boot 2.7.x compatibility -->
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.13</version>
+ <scope>test</scope>
</dependency>
Review 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:
1. Keep Logback 1.2.13 and explicitly declare slf4j-api 1.7.36 as a dependency in this module, OR
2. 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)
```suggestion
</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>
```
##########
fesod-examples/fesod-sheet-examples/pom.xml:
##########
@@ -43,6 +43,23 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- Use Logback 1.2.x with SLF4J 1.7.x for Spring Boot 2.7.x compatibility -->
Review 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.
```suggestion
<!-- Use Logback 1.2.x; SLF4J version is inherited from the parent POM (currently 2.0.17) -->
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fesod.apache.org
For additional commands, e-mail: commits-help@fesod.apache.org