- 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 is correct about log4j?
C - log4j does not guarantee that each log statement will be delivered to its destination.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following is correct about Level object?
A - The Level object defines the granularity and priority of any logging information.
Answer : C
Explanation
Both of the above options are correct.
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 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 p 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 : B
Explanation
p − Used to output the priority of the logging event.
Q 6 - What is the intent of %20c format modifier?
A - Left pad with spaces if the category name is less than 20 characters long.
B - Right pad with spaces if the category name is less than 20 characters long.
C - Truncate from the beginning if the category name is longer than 20 characters.
Answer : A
Explanation
%20c − Left pad with spaces if the category name is less than 20 characters long.
Q 7 - Which of the following set title for the HTML file using HTMLLayout?
A - HTMLLayout.setContentType(String)
B - HTMLLayout.setLocationInfo(String)
Answer : C
Explanation
HTMLLayout.setTitle(String) − Sets the title for the HTML file. Default is log4j Log Messages.
Q 8 - What is the purpose of maxBackupIndex configuration of RollingFileAppender?
A - to set the critical size of the file above which the file will be rolled.
Answer : B
Explanation
maxBackupIndex − This property denotes the number of backup files to be created.
Q 9 - What is the purpose of URL configuration of JDBCAppender?
B - to set the database password.
C - to specify the SQL statement to be executed every time a logging event occurs.
Answer : A
Explanation
URL − Sets the JDBC URL.
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.