- log4j Tutorial
- log4j - Home
- log4j - Overview
- log4j - Installation
- log4j - Architecture
- log4j - Configuration
- log4j - Sample Program
- log4j - Logging Methods
- log4j - Logging Levels
- log4j - Log Formatting
- log4j - Logging in Files
- log4j - Logging in Database
- log4j Useful Resources
- log4j - Questions and Answers
- log4j - Quick Guide
- log4j - Useful Resources
- log4j - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 log4j objects are responsible for capturing logging information?
Answer : A
Explanation
loggers − Responsible for capturing logging information.
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 method of logger print a log message in fatal mode?
A - public void debug(Object message)
B - public void error(Object message)
Answer : C
Explanation
public void fatal(Object message) of Logger class prints messages with the level Level.FATAL.
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 - What is the purpose of x character used in the conversionPattern of PatternLayout object?
B - Used to print the information stored in the MDC against the key.
D - Used to Left pad with spaces if the category name is less than 20 characters long.
Answer : A
Explanation
x − Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.
Q 7 - Which of the following set the location information for the logging event using HTMLLayout?
A - HTMLLayout.setContentType(String)
B - HTMLLayout.setLocationInfo(String)
Answer : B
Explanation
HTMLLayout.setLocationInfo(String) − Sets the location information for the logging event. Default is false.
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 9 - What is the purpose of sql 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 : C
Explanation
sql − Specifies the SQL statement to be executed every time a logging event occurs. This could be INSERT, UPDATE, or DELETE.
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.