I am going to use Log4j in my web application and I am new to that. What is the uses of Log4j and how I use it in my application. Thanks in advance.
I think the Log4J home page offers the best overview and rationale behind its use.
With log4j it is possible to enable logging at runtime without modifying the application binary. The log4j package is designed so that these statements can remain in shipped code without incurring a heavy performance cost. Logging behavior can be controlled by editing a configuration file, without touching the application binary.
Logging equips the developer with detailed context for application failures. On the other hand, testing provides quality assurance and confidence in the application. Logging and testing should not be confused. They are complementary. When logging is wisely used, it can prove to be an essential tool.
To add to this, with Log4J you can dynamically switch logging on/off. You can change the format dynamically (do you want timestamps ? datestamps ?) and you can change where the logging goes (to the console ? to a file ? to a database ?), all without changing your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With