
log4j Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to log4j Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - Which of the following is correct about log4j?
B - log4j has been ported to the C, C++, C#, Perl, Python, Ruby, and Eiffel languages.
C - log4j is highly configurable through external configuration files at runtime.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following is correct about Filter object?
B - An Appender objects can have several Filter objects associated with them.
Answer : C
Explanation
Both of the above options are correct.
Q 3 - Which of the following level designates error events that might still allow the application to continue running?
Answer : B
Explanation
ERROR − Designates error events that might still allow the application to continue running.
Q 4 - Which of the following level designates potentially harmful situations?
Answer : C
Explanation
WARN − Designates potentially harmful situations.
Q 5 - What is the purpose of F character used in the conversionPattern of PatternLayout object?
A - Used to output the category of the logging event.
B - Used to output the fully qualified class name of the caller issuing the logging request.
C - Used to output the date of the logging event.
D - Used to output the file name where the logging request was issued.
Answer : D
Explanation
F − Used to output the file name where the logging request was issued.
Q 6 - What is the purpose of x character used in the conversionPattern of PatternLayout object?
B - Used to print the information stored in the MDC against the key.
D - Used to Left pad with spaces if the category name is less than 20 characters long.
Answer : A
Explanation
x − Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.
Q 7 - Which of the following set title for the HTML file using HTMLLayout?
A - HTMLLayout.setContentType(String)
B - HTMLLayout.setLocationInfo(String)
Answer : C
Explanation
HTMLLayout.setTitle(String) − Sets the title for the HTML file. Default is log4j Log Messages.
Q 8 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at midnight each day?
Answer : B
Explanation
'.' yyyy-MM-dd − Roll over at midnight each day. This is the default value.
Q 9 - What is the purpose of password configuration of JDBCAppender?
A - to set the driver class to the specified string.
B - to set the database password.
C - to specify the SQL statement to be executed every time a logging event occurs.
Answer : B
Explanation
password − Sets the database password.
Q 10 - Appender can have a threshold level associated with it independent of the logger level.
Answer : A
Explanation
true − Appender can have a threshold level associated with it independent of the logger level. The Appender ignores any logging messages that have a level lower than the threshold level.