log4j - Overview
What is Logging ?
Logging is the process of writing the state of a program at various stages of its execution to some file or repository.By Logging,important statements related to your program execution can be sent to text file, console, or any other repository.
By implementing logging in any project a reliable monitoring and debugging solution can be achieved.
What is Logging ?
Logging is the process of writing the state of a program at various stages of its execution to some file or repository.By Logging,important statements related to your program execution can be sent to text file, console, or any other repository.
By implementing logging in any project a reliable monitoring and debugging solution can be achieved.
What is Log4j ?
Log4j is a simple and flexible logging framework.Log4j is an open source logging API for Java.
Log4j handles inserting log statements in application code and managing them externally without touching application code,by using external configuration files.It will categorize log statements according to user-specified criteria and assigns different priority levels to these log statements.
Log4j lets users choose from several destinations for log statements, such as console, file, database, SMTP servers, GUI components etc.
By using log4j we can customized formats for log output and provides default formats.
Advantage of using log4j
It will Organizes the log output in separate categories , makes easy to find the source of an error easily
Log4j assigns priority levels to loggers and log requests , it will wipe out unnecessary log output and allows only important log statements to be logged
Installation of Log4j
log4j API package is distributed under the Apache Software License.The latest log4j version, including full-source code, class files and documentation can be found by clicking here.
Download log4j4j jar from here .After downloading extract the log4j jar at any desired location and include its absolute path in the application's CLASSPATH.
Now ,log4j API is accessible to user's application classes and can be used for logging.