<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
SpringBoot使用他来做日志
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>2.1.6.RELEASE</version>
<scope>compile</scope>
</dependency>
springboot底层日志依赖关系
总结:
- SpringBoot底层使用slf4j和logback进行日志记录
- springboo把其他日志替换成slf4j
- 中间替换包 :偷梁换柱 底层实际上用的还是slf4j
如果我们要引入其他框架?一定要把要把这个框架默认日志依赖移除掉
SpringBoot能自动适配所有日志,而且底层使用slf4j+logback方式记录日志,引入其他框架时,只需要把这个框架依赖的日志框架排除掉.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
在web模块中将commons-logging排除掉