- 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 Logger object?
A - The top-level layer of log4j architecture is the Logger which provides the Logger object.
Answer : C
Explanation
Both of the above options are correct.
Q 2 - Which of the following is correct about Layout object?
B - It provides support to appender objects before publishing logging information.
Answer : D
Explanation
All of the above options are correct.
Q 3 - Which of the following level designates fine-grained informational events that are most useful to debug an application?
Answer : A
Explanation
DEBUG − Designates fine-grained informational events that are most useful to debug an application.
Q 4 - Which of the following is true about log4j levels?
A - A log request of level p in a logger with level q is enabled if p >= q.
B - A log request assumes that levels are ordered.
C - For the standard levels, we have ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF.
Answer : D
Explanation
All of the above options are correct.
Q 5 - What is the purpose of r 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 : C
Explanation
r − Used to output the number of milliseconds elapsed from the construction of the layout until the creation of 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 - What is the purpose of maxFileSize configuration of RollingFileAppender?
A - to set the critical size of the file above which the file will be rolled.
Answer : A
Explanation
maxFileSize − This is the critical size of the file above which the file will be rolled.
Q 9 - What is the purpose of password configuration of JDBCAppender?
A - to set the driver class to the specified string.
B - to set the database password.
C - to specify the SQL statement to be executed every time a logging event occurs.
Answer : B
Explanation
password − Sets the database password.
Q 10 - The Logger object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.
Answer : B
Explanation
false − The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.