[PROPOSAL] Migrate Commons JEXL from Commons Logging to SLF4J
"单红宇" <[email protected]>
| Newsgroups | gmane.comp.jakarta.commons.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear Apache Commons JEXL developers,
I'm writing to propose migrating the Commons JEXL project from Apache Commons Logging
to SLF4J as the default logging facade.
-----------------------------------------------------------------------------------------
Apache Commons JEXL currently uses Apache Commons Logging as its default logging framework. While Commons Logging has served well historically, the Java logging landscape has evolved significantly. Many modern frameworks and applications now prefer and default to SLF4J (Simple Logging Facade for Java).
Why SLF4J is Recommended:
Modern Ecosystem Alignment: Most contemporary Java frameworks (Spring Boot, Hibernate, etc.) have migrated to or recommend SLF4J as their logging facade.
Superior Performance: SLF4J's parameterized logging (logger.debug("User {} logged in", username)) avoids the string concatenation overhead required by Commons Logging's isDebugEnabled() pattern.
Flexible Backend Support: SLF4J supports multiple logging implementations (Logback, Log4j2, JDK logging) without requiring code changes.
Better API Design: SLF4J provides a cleaner API with no checked exceptions and supports MDC (Mapped Diagnostic Context) for advanced logging scenarios.
Industry Standard: SLF4J has become the de facto standard for logging facades in modern Java applications.
Migration Benefits for JEXL:
Better Integration: Projects using SLF4J won't need bridging dependencies when using JEXL.
Performance Improvements: Parameterized logging in SLF4J can provide performance benefits.
Future-Proofing: Aligns JEXL with modern Java development practices.
Backward Compatibility: Existing projects can continue using Commons Logging via SLF4J's bridge (jcl-over-slf4j).
Proposed Approach:
Replace Commons Logging dependencies with SLF4J API
Update code to use SLF4J's parameterized logging patterns
Provide backward compatibility documentation
Backward Compatibility Note: SLF4J provides excellent backward compatibility. Projects currently using JEXL with Commons Logging can simply add the jcl-over-slf4j bridge dependency to route all Commons Logging calls through SLF4J without changing their logging configuration.
Willingness to Contribute: If the maintainers agree with this proposal, I would be happy to contribute the necessary code changes via a pull request. This would include:
Dependency updates in pom.xml
Code migration from Commons Logging to SLF4J patterns
Documentation updates
Test verification
References:
SLF4J Manual: http://www.slf4j.org/manual.html
Migration Guide: http://www.slf4j.org/legacy.html
jcl-over-slf4j bridge: Provides transparent redirection of Commons Logging calls to SLF4J
Thank you for considering this proposal to modernize JEXL's logging infrastructure.
单红宇
[email protected]