Log4j – Components of Log4j

Main Components of Log4j

Log4j has 3 main components which include Loggers, Appenders, Layouts

Loggers: – It’s a top-level component which is responsible for capturing your application’s information.

Appenders: – It’s a lower level component which is responsible to put logging information into given destination. Means where you want to store your information that will be taken care by Appenders.

Layouts: – This component is responsible for formatting your logging information so that it can be easy to read. It provides support to appender component before publishing log information.

Supporting Components

Level: – Level object defines the priority of the information to be logged based on configuration. There are 7 levels of the log which are given below: –

  1. OFF
  2. DEBUG
  3. INFO
  4. ERROR
  5. WARN
  6. FATAL
  7. ALL

 Filter: – Filter components is used to do analysis on logging information and decide whether to log that information or not. Basically, the filter is used by Appender component. All the information should go through the filter before it gets printed.

LogManager: – Log manager is responsible for complete logging framework. It verifies the configuration files and manages and gives direction to all the components involved.

Leave a Reply

Your email address will not be published. Required fields are marked *