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

Log4j Interview Questions and Answers

Mention what are the logging methods provided by logger class?

Logger class provides a variety of methods to handle logging activities. To obtain a logger object it provides two static methods

  • Public static logger getRootLogger();
  • Public static logger getLogger(String name);
Mention what is the difference between Threshold and LevelRangeFilter in log4j?

Both Threshold and LevelRangeFilter does the same thing. However threshold should be faster. Filters enable you to implement your own logic, and you can also link them together if required. If you need a basic threshold functionality, then “threshold” function will be enough.

In log4j how can you log into the database?

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

Explain how can you get multiple processes to log to the same file?

You may have each process log to a socket Appender. The receiving socket server can receive all the events and send them to a single log file.

Explain whether log4j is a thread safe?

Log4j is a thread safe, log4j components are built to be used in multithread systems.

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.