slf4j Logger 的 debug/error/info 方法在内部是如何工作的?

How do slf4j Logger's debug/error/info methods internally work?

我试图找到这些方法的实现,但没有成功。我想知道实现,以便我可以知道它是如何在内部处理 String 的。我在任何地方都找不到任何东西。可能是我看错地方了。请帮助 links/references。 非常感谢。

来自the SLF4J docs

The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks, such as java.util.logging, logback and log4j. SLF4J allows the end-user to plug in the desired logging framework at deployment time

因此,Logger 接口 在 SLF4J 库中声明,并且该接口的 实现 (即 "debug/error/info methods") 在您选择的任何底层日志记录框架中声明。

常见日志库的实现示例(或至少是实现的入口点):

注意:接口实现之间的关系对于Logback来说很简单(ch.qos.logback.classic.Logger实现org.slf4j.Logger)但是对于其他日志记录库,通常有一个适配层,它使 SLF4J 接口适应每个库中的实现。我在上面的列表中包含了其中一些 'adapters' 的链接,但 SLF4J GitHub 存储库中提供了更完整的集合:https://github.com/qos-ch/slf4j.