1、什么是SLF4J?
SLF4J不是一个具体的日志解决方案;
SLF4J是一个抽象层Abstract Layer,提供与其他具体日志模块对接;
slf4j-api-1.4.1.jar提供了统一的日志调用接口;
slf4j-log4j-1.4.1.jar提供了与log4j适配,静态绑定;
2、SLF4J优点在哪里?
A.能够与多种日志集成,可扩展性强;
B.占位符功能,在代码中用{}来表示,与 String的format()方法中 的%s非常相似;
logger.debug("Processing trade with id: {} and symbol : {} ", id, symbol);
3、SLF4J集成LOG4J
引入slf4j-api-1.6.1.jar、log4j-1.2.16.jar、slf4j-log4j12-1.6.1.jar;
参考信息:
https://www.oschina.net/translate/why-use-sl4j-over-log4j-for-logging