Log4j Interview Questions and Answers
Explain what is layouts in log4j?
Layout in log4j is responsible for formatting logging information in different styles.
Mention what is the best way to migrate from java.util logging to log4j?
The best way to migrate from java.util logged to log4j is to use global file search/replace method. It will replace with “org.apache.log4j.Logger”
Mention what are the two static methods for obtaining a logger object?
The two static methods for obtaining a logger object are
- Public static Logger getRootLogger()
- Public static Logger getLogger(String name)
Explain what are the format characters used in log4j?
The format characters used in log4j are
- L- it is used to output the line number from where the logging request was processed or issued
- m- It is used to output the application supplied message related with the logging event
- p-It is used to output the priority of the logging event
- C- It is used to output the class name of the caller issuing the logging request
Mention what are the other support objects in Log4j?
There are other support objects in Log4j framework they are
- Level Object
- Filter Object
- Object Renderer
- Log Manager