Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Log4j%20Interview%20Questions%20and%20Answers

Question: What is the importance of logging applications?
Answer:

Logging helps in debugging as well. Although debuggers are available but frankly it takes time to debug an application using a debugger. An application can be debugged more easily with few well-placed logging messages. So we can safely say that logging is a very good debugging tool. If logging is done sensibly and wisely, it can provide detailed context for application failures.
In distributed applications (e.g. web/remote applications), the logging is very important. The administrator can read logs to learn about the problems that occurred during some interval.
Java's built-in APIs provide logging options but they are not that flexible. Another option is to use Apache's open source logging framework called log4j. 

Drawbacks of logging applications:
There are some drawbacks of use logging in your application. For example: logging will
- pollute the code
- increase the size of the code
- reduce the speed

These are important points because, we ultimately want efficient applications. Log4J has the solution to this. You may turn on or turn off the logging at runtime by changing the configuration file. This means no change in the Java source code (binary).

To reduce the code now in Spring Framework you can use of AOP (Aspect Oriented Programming) where you can configure log mechanisms easily.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook