Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Log4j%20Interview%20Questions%20and%20Answers

Question: Describe about logger levels in log4j.
Answer: Before using log4j framework, one should be aware of different categories of log messages. Following are 5 categories:

DEBUG
The DEBUG Level is used to indicate events that are useful to debug an application. Handling method for DEBUG level is: debug().

INFO
INFO level is used to highlight the progress of the application. Handling method for INFO level is: info().

WARN
The WARN level is used to indicate potentially harmful situations. Handling method for WARN level is: warn().

ERROR
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().

FATAL
The Fatal level is used to indicate severe events that will may cause abortion of the application. Handling method for FATAL level is: fatal().

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.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook