- 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 ObjectRenderer object?
B - This object is used by Layout objects to prepare the final logging information.
Answer : C
Explanation
Both of the above options are correct.
Q 3 - Which of the following method of logger print a log message in trace mode?
A - public void warn(Object message)
B - public void trace(Object message)
Answer : B
Explanation
public void trace(Object message) of Logger class prints messages with the level Level.TRACE.
Q 4 - Which of the following level designates finer-grained informational events than the DEBUG?
Answer : B
Explanation
TRACE − Designates finer-grained informational events than the DEBUG.
Q 5 - What is the purpose of m character used in the conversionPattern of PatternLayout object?
A - Used to output location information of the caller which generated the logging event.
B - Used to output the line number from where the logging request was issued.
C - Used to output the application supplied message associated with the logging event.
D - Used to output the method name where the logging request was issued.
Answer : C
Explanation
m − Used to output the application supplied message associated with the logging event.
Q 6 - What is the intent of %.20c format modifier?
A - Left pad with spaces if the category name is less than 20 characters long.
B - Right pad with spaces if the category name is less than 20 characters long.
C - Truncate from the beginning if the category name is longer than 20 characters.
Answer : C
Explanation
%.20c − Truncate from the beginning if the category name is longer than 20 characters.
Q 7 - Which of the following set the location information for the logging event using HTMLLayout?
A - HTMLLayout.setContentType(String)
B - HTMLLayout.setLocationInfo(String)
Answer : B
Explanation
HTMLLayout.setLocationInfo(String) − Sets the location information for the logging event. Default is false.
Q 8 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at midday and midnight of each day?
Answer : C
Explanation
'.' yyyy-MM-dd-a − Roll over at midday and midnight of each day.
Q 9 - The layout layer of log4j architecture provides objects which are used to format logging information in different styles.
Answer : B
Explanation
true − The layout layer of log4j architecture provides objects which are used to format logging information in different styles. It provides support to appender objects before publishing logging information.
Q 10 - The target may be a console, a file, or another item depending on the appender.
Answer : A
Explanation
true − The target may be a console, a file, or another item depending on the appender.
To Continue Learning Please Login
Login with Google