- log4j Tutorial
- log4j - Home
- log4j - Overview
- log4j - Installation
- log4j - Architecture
- log4j - Configuration
- log4j - Sample Program
- log4j - Logging Methods
- log4j - Logging Levels
- log4j - Log Formatting
- log4j - Logging in Files
- log4j - Logging in Database
- log4j Useful Resources
- log4j - Questions and Answers
- log4j - Quick Guide
- log4j - Useful Resources
- log4j - Discussion
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 - It is optimized for speed.
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 method of logger print a log message in fatal mode?
A - public void debug(Object message)
B - public void error(Object message)
Answer : C
Explanation
public void fatal(Object message) of Logger class prints messages with the level Level.FATAL.
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 n character used in the conversionPattern of PatternLayout object?
A - Outputs the platform dependent line separator character or characters.
B - Used to output the priority of the logging event.
D - Used to output the name of the thread that generated the logging event.
Answer : A
Explanation
n − Outputs the platform dependent line separator character or characters.
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 the content type of html generated using HTMLLayout?
A - HTMLLayout.setContentType(String)
B - HTMLLayout.setLocationInfo(String)
Answer : A
Explanation
HTMLLayout.setContentType(String) − Sets the content type of the HTML content. Default is text/html.
Q 8 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs every minute?
Answer : A
Explanation
'.' yyyy-MM-dd-HH-mm − Roll over every minute.
Q 9 - The top-level layer of log4j architecture is the Logger which provides the Logger object.
Answer : A
Explanation
true − The top-level layer of log4j architecture is the Logger which provides the Logger object. The Logger object is responsible for capturing logging information and they are stored in a namespace hierarchy.
Q 10 - The log4j.properties file is a log4j configuration file which keeps properties in key-value pairs.
Answer : B
Explanation
true − The log4j.properties file is a log4j configuration file which keeps properties in key-value pairs. By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.
To Continue Learning Please Login
Login with Google