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.

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 : B

Explanation

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

Q 4 - Which of the following level designates potentially harmful situations?

A - OFF

B - TRACE

C - WARN

D - ALL

Answer : C

Explanation

WARN − Designates potentially harmful situations.

Answer : C

Explanation

m − Used to output the application supplied message associated with the logging event.

Answer : B

Explanation

X − The X conversion character is followed by the key for the MDC. For example, X{clientIP} will print the information stored in the MDC against the key clientIP.

Answer : C

Explanation

HTMLLayout.setTitle(String) − Sets the title for the HTML file. Default is log4j Log Messages.

Answer : B

Explanation

maxBackupIndex − This property denotes the number of backup files to be created.

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 - By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.

A - false

B - true

Answer : B

Explanation

true − By default, the LogManager looks for a file named log4j.properties in the CLASSPATH.

log4j_questions_answers.htm
Advertisements