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 formatting logging information in different styles?
layouts − Responsible for formatting logging information in different styles.
Q 2 - Which of the following is correct about target in Appender?
target − The target may be a console, a file, or another item depending on the appender.
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 designates potentially harmful situations?
WARN − Designates potentially harmful situations.
Q 5 - What is the purpose of r character used in the conversionPattern of PatternLayout object?
r − Used to output the number of milliseconds elapsed from the construction of the layout until the creation of the logging event.
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 bufferedIO configuration of FileAppender?
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 on the first day of each week depending upon the locale?
'.' yyyy-ww − Roll over on the first day of each week depending upon the locale.
Q 9 - What is the purpose of sql configuration of JDBCAppender?
sql − Specifies the SQL statement to be executed every time a logging event occurs. This could be INSERT, UPDATE, or DELETE.
Q 10 - By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.
true − By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.