Log4j
Log4j is the project run by The Apache Software Foundation. This project helps in enabling the logs at the various levels of the server and application.
The major advantage of log4j is manageability. It provides the developer a freedom to change the log level at the configuration file level. Also, you can enable/disable logs at the configuration level, so there is no need to change the code. We can customize the log pattern based on the application, separately. Log4j has six log levels. The following figure shows the different types of log levels in log4j:
Log level for log4j
Every log level in log4j has its own functionality. The following table shows the functionality of each log level in log4j:
Log level |
Description |
---|---|
OFF |
This level is set when you want logging to be set as |
FATAL |
This log level will print the severe errors that cause premature termination. |
ERROR |
This log level is used to capture runtime errors or unexpected conditions. Expect these... |