https://www.cnblogs.com/0201zcr/p/5726072.html
Log4j的组成:
Log4j的三个重要组成:
- 日志记录器(Loggers)
- 输出端(Appenders)
- 日志格式化器(Layout)
1 | org.apache.logging.log4j.core.Layout负责格式 |
LoggerContext
在日志系统中,LoggerContext有重要的作用,根据实际情况,一个应用可能存在多个有效的LoggerContext。
Configuration
每一个LoggerContext都有一个有效的Configuration。在重新配置期间,两个Configuration会同时存在;一旦日志器被重新赋予新的Configuration,旧的Configuration就会停止工作并丢弃。
The LoggerContext is the anchor for the logging system. It maintains a list of all the loggers requested by applications and a reference to the Configuration. The Configuration will contain the configured loggers, appenders, filters, etc and will be atomically updated whenever a reconfigure occurs.