- log4j - Home
- log4j - Overview
- log4j - Installation
- log4j - Architecture
- log4j - Configuration
- log4j - Sample Program
- log4j - Logging Methods
- log4j - Logging Levels
- log4j - ConsoleAppender
- log4j - Logging in Database
Log4j - Formatting Layouts
- log4j - Log Formatting
- log4j - CSV Parameter Layout
- log4j - CSV Log Event Layout
- log4j - HTML Layout
- log4j - Pattern Layout
- log4j - Json Template Layout
Log4j - File Appenders
- log4j - Logging in Files
- log4j - FileAppender
- log4j - Separate Folder per Month
- log4j - Daily log File Generation
log4j Resources
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?
A - It supports multiple output appenders per logger.
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 Appender object?
A - This is a lower-level layer of log4j architecture which provides Appender objects.
Answer : C
Explanation
Both of the above options are correct.
Q 3 - Which of the following method of logger print a log message in debug mode?
A - public void debug(Object message)
B - public void error(Object message)
Answer : A
Explanation
public void debug(Object message) of Logger class prints messages with the level Level.DEBUG.
Q 4 - Which of the following level designates informational messages that highlight the progress of the application at coarse-grained level?
Answer : D
Explanation
INFO − Designates informational messages that highlight the progress of the application at coarse-grained level.
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 - Which of the following is correct about org.apache.log4j.HTMLLayout class?
B - It provides the name of the thread that invoked the logging request.
C - It provides the level associated with this logging request.
Answer : D
Explanation
All of the above options are correct.
Q 7 - What is the purpose of bufferedIO configuration of FileAppender?
A - logging information to be appended to the end of the same file.
Answer : B
Explanation
bufferedIO − This flag indicates whether we need buffered writing enabled. By default, it is set to false.
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 Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.
Answer : B
Explanation
true − The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.
Q 10 - The Filter objects can analyze logging information beyond level matching and decide whether logging requests should be handled by a particular Appender or ignored.
Answer : A
Explanation
true − The Filter objects can analyze logging information beyond level matching and decide whether logging requests should be handled by a particular Appender or ignored.