There are several logging levels that you can configure in your application.
Anybody who is using logging in java must be familiar with basic java logging level e.g. DEBUG, INFO, WARN and ERROR.
Those are FATAL, ERROR, WARN, TRACE, DEBUG, INFO OR ALL in Apache logging. Default logging level is INFO.
Logging levels are given below:
1. ALL: All levels including custom levels also.
2. DEBUG: The DEBUG Level is used to indicate events that are useful to debug an application. Handling method for DEBUG level is: debug().
3. INFO: It gives the information about the progress of application and its states. General tips, news information etc.
4. WARN: It gives warning for unexpected events. The WARN level is used to indicate potentially harmful situations. Handling method for WARN level is: warn().
5. ERROR: It provides the information about error events. The ERROR level shows errors messages that might not be serious enough and allow the application to continue. Handling method for ERROR level is: error().
6. FATAL: It provides the information about application abort. The Fatal level is used to indicate severe events that will may cause abortion of the application. Handling method for FATAL level is: fatal().
7. OFF: It turns off all the logging. It is opposite to the ALL level. OFF java logging level has the highest possible rank and is intended to turn off logging in Java.
Standard order of all logging levels:
ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF.
i.e. If logging level set to FATAL then only FATAL messages will be displayed, if logging level set to ERROR then ERROR and FATAL messages will be displayed and so on.
In the below example as we set the logging level to WARN so only WARN, ERROR and FATAL messages will be displayed. The DEBUG and INFO message will not display.
If you declare log level as debug in the configuration file, then all the other log messages will also be recorded.
If you declare log level as info in the configuration file, then info, warn, error and fatal log messages will be recorded.
If you declare log level as warn in the configuration file, then warn, error and fatal log messages will be recorded.
If you declare log level as error in the configuration file, then error and fatal log messages will be recorded.
If you declare log level as fatal in the configuration file, then only fatal log messages will be recorded.