log4j Online Quiz


Advertisements

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.

Questions and Answers

Q 1 - Which of the following log4j objects are responsible for formatting logging information in different styles?

A - loggers

B - appenders

C - layouts

D - None of the above.

Answer : C

Explanation

layouts − Responsible for formatting logging information in different styles.

Answer : A

Explanation

public void warn(Object message) of Logger class prints messages with the level Level.WARN.

Answer : B

Explanation

C − Used to output the fully qualified class name of the caller issuing the logging request. For example, for the class name.* "org.apache.xyz.SomeClass", the pattern %C{1} will output "SomeClass".

Answer : A

Explanation

l − Used to output location information of the caller which generated the logging event.

Answer : A

Explanation

x − Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging event.

Answer : B

Explanation

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 at midnight each day?

A - '.' yyyy-MM

B - '.' yyyy-MM-dd

C - '.' yyyy-MM-dd-a

D - '.' yyyy-MM-dd-HH

Answer : B

Explanation

'.' yyyy-MM-dd − Roll over at midnight each day. This is the default value.

Q 9 - The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

A - false

B - true

Answer : B

Explanation

true − The Appender object is responsible for publishing logging information to various preferred destinations such as a database, file, console, UNIX Syslog, etc.

Q 10 - Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.

A - false

B - true

Answer : B

Explanation

true − Appender uses the Layout objects and the conversion pattern associated with them to format the logging information.

log4j_questions_answers.htm
Advertisements