Understanding Apache Log4j
Overview of the log4j architecture:
The architecture of the log4j API is layerd. Each layer consist of different objects performing different task.
The Top layer captures the logging information
The middle layer is involved in analyzing and authorizing the logging information
The bottom layer is responsible for formating and publishing the logging information
In essence, log4j consist of three types of primary objects:
- Logger : is responsible for capturing the logging information
- Appender: logging information to various prefered destinations
- Layout: is used to format information in different styles.
Apart form them, there are several auxiliary objects that can plug and play to any layer of the API:
- Level: there are seven levels of logging defiend within the Api:OFF,DEBUG,INFO,ERROR,WARN,FATAL and ALL.
- Filter: is used to analyze logging information and make further decisions on wheter that information should be logged or not
- ObjectRender: is specialized in providing a String representation of differetn objects passed to the logging framwork.
- LogManager: is responsible for reading and initial configuration parameters from a system-wide configuration file or a configuration class
it‘s time to discuss how they interact with each other:
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。