SLF4J 意在为不同的logging API提供一个简单的facade,从而最终用户根据部署的需要进行相关的实现。
用户可以直接实现 SLF4J 的接口,比如 NLOG4J 或者 SimpleLogger都是这么作的,或者我们为指定的接口实现相关的SLF4J 适配器,比如Log4jLoggerAdapter 和 JDK14LoggerAdapter。
官方提到:
SLF4J does not rely on any special class loader machinery. In fact, the binding between SLF4J and a given logging API implementation is performed statically at compile time. Each binding is hardwired to use one and only specific logging API implementation. Thus, SLF4J suffers from none of the class loader problems or memory leaks observed with other approaches.
标签: