Log4j Introduction
Logging within the context of program development constitutes inserting statements into the program that provide some kind of output information that is useful to the developer. Inserting log statements into your code is a general method for debugging it. Examples of logging are trace statements, dumping of structures and the familiar System.out.println or printf debug statements
Log4j is a open source debugging tool developed for putting log statements into your application., written in Java, which logs statements to a file, a java.io.Writer, or a syslog daemon. Log4j offers a hierarchical way to insert logging statements within a Java program. Multiple output formats and multiple levels of logging information are available.
One of the distinctive features of log4j is the notion of inheritance in loggers. Using a logger hierarchy it is possible to control which log statements are output at arbitrarily fine granularity but also great ease. This helps reduce the volume of logged output and minimize the cost of logging.
By using a dedicated logging package, the overhead of maintaining thousands of System.out.println statements is alleviated as the logging may be controlled at runtime from configuration scripts.
It's speed and flexibility allows log statements to remain in shipped code while giving the user the ability to enable logging at runtime without modifying any of the application binary. All of this while not incurring a high performance cost.
Logging does have its drawbacks. It can slow down an application. If too verbose, it can cause scrolling blindness. To alleviate these concerns, log4j is designed to be reliable, fast and extensible. Since logging is rarely the main focus of an application, the log4j API strives to be simple to understand and to use.
All enterprise architectures adopt a global logging framework. The logging framework provides classes/interfaces for logging messages, errors and debug statements to destinations like files, databases, e-mails and consoles throughout the system. The logged information is useful to an end-user of an application or to a system administrator. Internationalization in a logging framework is the ability to log the messages in different languages. All logging frameworks will be rated on internationalization and extensibility. The following logging frameworks are available:
• JavaTM Logging
• Jlog
• Log4j
• Protomatter
• BEA mechanism for logging (technically not a full feature framework)
• Message LFW
0 comments:
Post a Comment