No log when use commons-loggins and spring-boot

本文介绍Spring框架中自定义的Commons Logging API桥接实现,该实现支持Log4J2、SLF4J和java.util.logging。文章详细阐述了Spring如何通过其定制化的桥接提供更优的日志体验,并探讨了不同场景下的使用建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://docs.spring.io/spring-framework/docs/current/javadoc-api/index.html?org/apache/commons/logging/package-summary.html

Spring’s variant of the Commons Logging API: with special support for Log4J 2, SLF4J and java.util.logging.
This is a custom bridge along the lines of jcl-over-slf4j. You may exclude spring-jcl and switch to jcl-over-slf4j instead if you prefer the hard-bound SLF4J bridge. However, Spring’s own bridge provides a better out-of-the-box experience when using Log4J 2 or java.util.logging, with no extra bridge jars necessary, and also easier setup of SLF4J with Logback (no JCL exclude, no JCL bridge).

Log is equivalent to the original. However, LogFactory is a very different implementation which is minimized and optimized for Spring’s purposes, detecting Log4J 2.x and SLF4J 1.7 in the framework classpath and falling back to java.util.logging. If you run into any issues with this implementation, consider excluding spring-jcl and switching to the standard commons-logging artifact or to jcl-over-slf4j.

Note that this Commons Logging bridge is only meant to be used for framework logging purposes, both in the core framework and in extensions. For applications, prefer direct use of Log4J/SLF4J or java.util.logging.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值