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 publishing logging information to various preferred destinations?
appenders − Responsible for publishing logging information to various preferred destinations.
Q 2 - Which of the following is correct about ObjectRenderer object?
Both of the above options are correct.
Q 3 - Which of the following method of logger print a log message in info mode?
public void info(Object message) of Logger class prints messages with the level Level.INFO.
Q 4 - Which of the following level is intended to turn off logging?
OFF − The highest possible rank and is intended to turn off logging.
Q 5 - What is the purpose of M character used in the conversionPattern of PatternLayout object?
M − Used to output the method name where the logging request was issued.
Q 6 - What is the intent of %20.30c format modifier?
%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 immediateFlush configuration of FileAppender?
immediateFlush − This flag is by default set to true, which means the output stream to the file being flushed with each append operation.
Q 8 - What is the purpose of maxBackupIndex configuration of RollingFileAppender?
maxBackupIndex − This property denotes the number of backup files to be created.
Q 9 - How will you put the logs in database using log4j??
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.
true − The target may be a console, a file, or another item depending on the appender.