- 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?
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 layout object in Appender?
B - The Layout objects may be a console, a file, or another item depending on the appender.
C - The Layout objects is required to control the filtration of the log messages.
D - Appender can have a Layout objects associated with it independent of the logger level.
Answer : A
Explanation
layout − Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.
Q 3 - Which of the following level designates error events that might still allow the application to continue running?
Answer : B
Explanation
ERROR − Designates error events that might still allow the application to continue running.
Q 4 - Which of the following level is intended to turn off logging?
Answer : A
Explanation
OFF − The highest possible rank and is intended to turn off logging.
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 - 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 end of each month and at the beginning of the next month?
Answer : A
Explanation
'.' yyyy-MM − Roll over at the end of each month and at the beginning of the next month.
Q 9 - How will you put the logs in database using log4j??
Answer : A
Explanation
The log4j API provides the org.apache.log4j.jdbc.JDBCAppender object, which can put logging information in a specified database.
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.