- 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 log4j objects are responsible for publishing logging information to various preferred destinations?
Answer : B
Explanation
appenders − Responsible for publishing logging information to various preferred destinations.
Q 2 - Which of the following is correct about Level object?
A - The Level object defines the granularity and priority of any 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 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 L 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 : B
Explanation
L − Used to output the line number from where the logging request was issued.
Q 6 - What is the intent of %-20.30c format modifier?
C - Truncate from the beginning if the category name is longer than 20 characters.
Answer : B
Explanation
%-20.30c − Right pad with spaces if the category name is shorter than 20 characters. However, if the category name is longer than 30 characters, then truncate from the beginning.
Q 7 - What is the purpose of Filename configuration of FileAppender?
A - output stream to the file being flushed with each append operation.
B - to set the platform-specific encoding scheme.
Answer : D
Explanation
Filename − The name of the log file.
Q 8 - Which of the following DatePattern configuration of DailyRollingFileAppender rolls over the logs at the top of every hour?
Answer : D
Explanation
'.' yyyy-MM-dd-HH − Roll over at the top of every hour.
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 Level object defines the granularity and priority of any logging information.
Answer : A
Explanation
true − The Level object defines the granularity and priority of any logging information. There are seven levels of logging defined within the API: OFF, DEBUG, INFO, ERROR, WARN, FATAL, and ALL.
To Continue Learning Please Login
Login with Google