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

Answer : A

Explanation

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

Q 4 - Which of the following level designates all levels including custom levels?

A - OFF

B - TRACE

C - WARN

D - ALL

Answer : D

Explanation

ALL − All levels including custom levels.

Answer : C

Explanation

d − Used to output the date of the logging event. For example, %d{HH:mm:ss,SSS} or %d{dd MMM yyyy HH:mm:ss,SSS}.

Answer : C

Explanation

%.20c − Truncate from the beginning if the category name is longer than 20 characters.

Q 7 - Which of the following set the location information for the logging event using HTMLLayout?

A - HTMLLayout.setContentType(String)

B - HTMLLayout.setLocationInfo(String)

C - HTMLLayout.setTitle(String)

D - None of the above.

Answer : B

Explanation

HTMLLayout.setLocationInfo(String) − Sets the location information for the logging event. Default is false.

Answer : C

Explanation

DatePattern − This indicates when to roll over the file and the naming convention to be followed. By default, roll over is performed at midnight each day.

Answer : A

Explanation

The log4j API provides the org.apache.log4j.jdbc.JDBCAppender object, which can put logging information in a specified database.

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

A - true

B - false

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.

log4j_questions_answers.htm
Advertisements