+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

Log4j Interview Questions and Answers

Explain what is Log4j?

Log4j is a fast, flexible and reliable logging framework written in Java developed in early 1996. It is distributed under the Apache software license and can be used for small to large scale projects. It has been ported to the languages like C, C++, C#, Python, etc.

What are the different logging levels?

There are several logging levels that you can configure in you applicaiton
Those are FATAL,ERROR,WARN,TRACE,DEBUG,INFO OR ALL in apache logging. Default logging level is INFO.

Explain why to use Log4j?
  • Being open-source its completely free to use.
  • You can easily save log information into either files or even databases.
  • Can be used for projects of any sizes small or large.
What are different types of logs?

Usually in any application there two types of logs

  1. Application server logs :- These are the logs configured at the application server level. for example in tomcat,
    we have log files called localhost.log. tomcat.log,catalina.log, stdout.log, sterr.log. all these logs are showing with default settings defined in logging.properites located in your tomcat installation folder/conf folder.
    if you want custom settings, we have to change the different parameters in logging.properties in conf folder of tomcat directory.
  2. Application logs:- We can define logging at each applicaiton level, For this we have to create log4j.xml or logging.properties in WEB-INF/classes folder.
Mention what are the three principal components of Log4j?

The three principal components of Log4j are

  • Loggers
  • Appenders
  • Layout
Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.