ERP Web Application Development
Log 4j
Log 4j is a popular framework developed in 1996 and is a product of Apache software foundation. It is an open source, flexible framework that is used as a debugging tool in software projects. Besides, it tells the status of the application, how it is executed and used for the small as well as large projects. Log 4j is integrated in order to replace the use of SOP statements in projects.
Disadvantage
It slows down the execution.
Drawbacks of Using SOP Statement
1-By using SOP statement log messages are printed on console only, when we close the console then all logs messages are also removed.
2-On console we cannot store log messages as permanent; they are stored temporary and the message prints one by one on the console.
Components of Log 4j
There are the three components of Log 4j framework:-
1-Loggers
2-Appenders
3-Layout
Logger
It is the component that is used for logging information below are the steps used to implement logger into the project.
1. Create a instance for logger class
Logger class is the class in org.apache log4j package. In order to use logger in a project, we have to initialize one logger object for each java class and use the logger class method to generate log statements in the project.
Syntax to get logger object in java class
Static Logger logger = Logger.getLogger(CurrentClass.Class.getName());
Various levels of logger
Levels of logger are used in the project to define the type of logging information it depends upon the operation which you are performing.
1. All: It is the level which logs everything which means it makes all the logs on.
2. Debug: It is the level which is mainly used during the development stage that helps the developers to track the bug easily.
3. Info: It is the level which indicates the progress of the application by printing informational messages in the destination file.
4. Warm: It is the level which is used to print information regarding unexpected behaviour of the system.
5. Error: It is the level which is used when we want to print the error message without affecting the flow of execution.
Appender
It is the component which is responsible to store the logging information to various preferred destinations (e.g. file, database, console, e-mail).
Layout
It the component which specifies the format in which format we have to store the logging information at destination(e.g. file, database, console, e-mail)
We, at Oodles, provide complete enterprise solutions to solve complex business problems and overcome cross-industry business challenges. Our custom web development services enable organizations to enhance their business productivity and improve operational efficiency. For more information, contact us at erp@oodles.io