Log4j框架

  • There are two types of objects available with log4j framework.

    • Core Objects: These are mandatory objects of the framework. They are required to use the framework.

    • Support Objects: These are optional objects of the framework. They support core objects to perform additional but important tasks.

    Core Objects

    Core objects include the following types of objects −

    Logger Object

    The top-level layer is the Logger which provides the Logger object. The Logger object is responsible for capturing logging information and they are stored in a namespace hierarchy.

    Layout Object

    The layout layer provides objects which are used to format logging information in different styles. It provides support to appender objects before publishing logging information.

    Layout objects play an important role in publishing logging information in a way that is human-readable and reusable.

    Appender Object

    This is a lower-level layer which provides Appender objects. The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

    The following virtual diagram shows the components of a log4J framework:

    log4j Architecture

    Support Objects

    There are other important objects in the log4j framework that play a vital role in the logging framework:

    Level Object

    The Level object defines the granularity and priority of any logging information. There are seven levels of logging defined within the API: OFF, DEBUG, INFO, ERROR, WARN, FATAL, and ALL.

    Filter Object

    The Filter object is used to analyze logging information and make further decisions on whether that information should be logged or not.

    An Appender objects can have several Filter objects associated with them. If logging information is passed to a particular Appender object, all the Filter objects associated with that Appender need to approve the logging information before it can be published to the attached destination.

    ObjectRenderer

    The ObjectRenderer object is specialized in providing a String representation of different objects passed to the logging framework. This object is used by Layout objects to prepare the final logging information.

    LogManager

    The LogManager object manages the logging framework. It is responsible for reading the initial configuration parameters from a system-wide configuration file or a configuration class.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值