<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring‐boot‐starter</artifactId>
</dependency>

SpringBoot使用它来做日志功能

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring‐boot‐starter‐logging</artifactId>
</dependency>

底层依赖关系
12 SpringBoot日志关系
总结

1)、SpringBoot底层也是使用slf4j+logback的方式进行日志记录
2)、SpringBoot也把其他的日志都替换成了slf4j;
3)、中间替换包?

@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();

12 SpringBoot日志关系
4)、如果我们要引入其他框架?一定要把这个框架的默认日志依赖移除掉?
Spring框架用的是commons-logging;

<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的方式记录日志,引入其他框架的时候,只需要把这个框架依赖的日志框架排除掉即可;

相关文章:

  • 2021-12-01
  • 2021-10-23
  • 2021-09-30
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-01-07
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2021-09-06
  • 2021-09-20
  • 2021-07-29
相关资源
相似解决方案