• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

无信不立

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

【spring-boot】spring-boot框架日志框架加载过程实现

一、整体流程

1、spring-boot的jar包,中META-INF/spring.factories文件会在spring容器中注入ApplicationListener接口实现

org.springframework.context.ApplicationListener=\
org.springframework.boot.ClearCachesApplicationListener,\
org.springframework.boot.builder.ParentContextCloserApplicationListener,\
org.springframework.boot.context.FileEncodingApplicationListener,\
org.springframework.boot.context.config.AnsiOutputApplicationListener,\
org.springframework.boot.context.config.ConfigFileApplicationListener,\
org.springframework.boot.context.config.DelegatingApplicationListener,\
org.springframework.boot.context.logging.ClasspathLoggingApplicationListener,\
org.springframework.boot.context.logging.LoggingApplicationListener,\
org.springframework.boot.liquibase.LiquibaseServiceLocatorApplicationListener
View Code

2、其中org.springframework.boot.context.logging.LoggingApplicationListener会在容器启动前,进行日志装配功能

3、org.springframework.boot.logging.LoggingSystem会通过反射,尝试在当前项目中依次加载如下配置的类,加载到那个,则使用哪个作为当前项目的日志框架

4、如加载到org.apache.logging.log4j.core.impl.Log4jContextFactory类,则使用org.springframework.boot.logging.log4j2.Log4J2LoggingSystem类初始化日志框架

 

posted on 2020-08-04 22:16  无信不立  阅读(387)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3