Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Log4j Interview Questions and Answers For Graduates Part-3

Be First!

log4j21.How will you create a logger in any class?
Any other named Logger object instance is obtained through the second method by passing the name of the logger. The name of the logger can be any string you can pass, usually a class or a package name as we have used in the last chapter and it is mentioned below −

static Logger log = Logger.getLogger(log4jExample.class.getName());

22.How will you print a log message in debug mode?
public void debug(Object message) of Logger class prints messages with the level Level.DEBUG.

23.How will you print a log message in error mode?
public void error(Object message) of Logger class prints messages with the level Level.ERROR.

24.How will you print a log message in fatal mode?
public void fatal(Object message) of Logger class prints messages with the level Level.FATAL.

25.How will you print a log message in info mode?
public void info(Object message) of Logger class prints messages with the level Level.INFO.

26.How will you print a log message in warn mode?
public void warn(Object message) of Logger class prints messages with the level Level.WARN.

27.How will you print a log message in trace mode?
public void trace(Object message) of Logger class prints messages with the level Level.TRACE.

28.What is purpose of ALL log level?
ALL − All levels including custom levels.

29.What is purpose of DEBUG log level?
DEBUG − Designates fine-grained informational events that are most useful to debug an application.

30.What is purpose of ERROR log level?
ERROR − Designates error events that might still allow the application to continue running.

(140)

Previous
Next

Leave a Reply