Reading:  

What is Log4J. An absolute beginners tutorial.


Log4j Architecture - Main components

Log4j API mainly designed on layered architecture where object in each layer perform different task assigned to it.

Here is an Image showing the flow and main components of Log4J

Log4J Architecture

Log4j framework has two types of objects:-

  • Core Objects:This frameworks main object.
  • Support Objects: It is Frameworks optional objects to do additional tasks which are important.

 

Core Objects:

Logger Object:

Capturing logging information and storing in namespace hierarchy is responsibility of Logger object.

Layout Object:

The layer provides objects are used for format logging information in different styles. Layout objects helps in publishing logging information in human-readable and reusable form.

Appender Object:

The Appender object main responsibility is to  publish logging informations to various preferred destinations such as a file, database, console, UNIX Syslog etc.

 

Support Objects:

Some of important objects in log4j framework that play vital role are:

Level Object:

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

Filter Object:

It is used to analyze logging information’s and make decisions on whether the information should be logged or not.

ObjectRenderer:

The ObjectRenderer object specializes in providing String representation of different objects passed to logging framework.

LogManager:

LogManager object manages logging framework. It’s responsible for reading initial configuration parameters from configuration class or system-wide configuration file.

Description

This tutorial is aimed at learners who want to get an understaind on what Log4J is and what it is used for. This tutorial have 10 part to it as shown below

  1. Overview    
  2. How to Install Log4J
  3. Understanding Architecture
  4. Getting started with Log4J Configuration
  5. Sample Program
  6. Logging Methods
  7. Understanding different Logging Levels
  8. Log4J log formatting
  9. How to log in files
  10. How to log in database using Log4J

We hope that this tutorial will help you out with Log4J. Please note that this tutorial is for absolute starters and does not go into much depth. Let us know how we can improve by sending  your feedback.



Prerequisites

A good understanding of Java programming language is required.

Audience

Absolute beginners

Author: Subject Coach
Added on: 7th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!