企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> ``` SpringBoot使用它来做日志功能; ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </dependency> ``` 底层依赖关系 ![](images/搜狗截图20180131220946.png) 总结: ​ 1)、SpringBoot底层也是使用slf4j+logback的方式进行日志记录 ​ 2)、SpringBoot也把其他的日志都替换成了slf4j; ​ 3)、中间替换包? ```java @SuppressWarnings("rawtypes") public abstract class LogFactory { static String UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J = "http://www.slf4j.org/codes.html#unsupported_operation_in_jcl_over_slf4j"; static LogFactory logFactory = new SLF4JLogFactory(); ``` ![](images/搜狗截图20180131221411.png) ​ 4)、如果我们要引入其他框架?一定要把这个框架的默认日志依赖移除掉? ​ Spring框架用的是commons-logging; ```xml <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> ``` **==SpringBoot能自动适配所有的日志,而且底层使用slf4j+logback的方式记录日志,引入其他框架的时候,只需要把这个框架依赖的日志框架排除掉即可;==**