Log4j Introduction

Logging is one of the important component for any application. It helps developer to debug application easily. Apache has provided one framework for logging- Log4j

It is relieable, fast and easy to use framework and licensed under Apache Software foundation.

Latest Version- Log4j 2

It can be easily integrated with any of the Java web application framework like struts,Jsf etc

It has three major component:

loggers- Logging can be done at different levels.

appenders- Logging can be done in different destinations like file,console etc.

layouts- Logging can be done in different formats.

Latest version,documentation,jars etc details can be found at location- http://logging.apache.org/log4j/

Log4j Configuration-

Logging can be configured in two ways-

log4j.properties

log4j.xml

We can use any of the above way and for that configuration file needs to be set at classpath.