
- 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 internationalization.
B - It is not restricted to a predefined set of facilities.
C - Logging behavior can be set at runtime using a configuration file.
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 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 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 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 : A
Explanation
l − Used to output location information of the caller which generated the logging event.
Q 6 - Which of the following is correct about org.apache.log4j.HTMLLayout class?
Answer : C
Explanation
Both of the above options are correct.
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 every minute?
Answer : A
Explanation
'.' yyyy-MM-dd-HH-mm − Roll over every minute.
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.