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 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 is correct about threshold in Appender?
B - The threshold may be a console, a file, or another item depending on the appender.
C - The threshold is required to control the filtration of the log messages.
D - Appender can have a threshold associated with it independent of the logger level.
Answer : D
Explanation
threshold − Appender can have a threshold level associated with it independent of the logger level. The Appender ignores any logging messages that have a level lower than the threshold level.
Q 4 - Which of the following level designates finer-grained informational events than the DEBUG?
Answer : B
Explanation
TRACE − Designates finer-grained informational events than the DEBUG.
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 - What is the intent of %20.30c format modifier?
C - Truncate from the beginning if the category name is longer than 20 characters.
Answer : A
Explanation
%20.30c − Left 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 fileAppend configuration of FileAppender?
A - logging information to be appended to the end of the same file.
Answer : A
Explanation
fileAppend − This is by default set to true, which means the logging information being appended to the end of the same 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 user configuration of JDBCAppender?
B - to set the database user name.
C - to specify the SQL statement to be executed every time a logging event occurs.
Answer : B
Explanation
user − Sets the database user name.
Q 10 - By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.
Answer : B
Explanation
true − By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.