| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| |
| <!-- Content Stylesheet for Site --> |
| |
| |
| |
| |
| |
| <!-- start the processing --> |
| <!-- ====================================================================== --> |
| <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! --> |
| <!-- Main Page Section --> |
| <!-- ====================================================================== --> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> |
| |
| <meta name="author" value="Ceki Gulcu"> |
| <meta name="email" value="ceki@apache.org"> |
| |
| |
| <meta name="keywords" content="java, logging, tracing, component, framework, API, log4j" /> |
| |
| |
| <link href="./css/site.css" rel="stylesheet" type="text/css"/> |
| |
| |
| <title>Log4j project - Introduction</title> |
| </head> |
| |
| <body bgcolor="#ffffff" text="#000000" link="#525D76"> |
| <!-- START Header table --> |
| <table class="banner" border="0"> |
| <tr> |
| <td valign="top"> |
| <a href="http://logging.apache.org/"> |
| <img src="http://logging.apache.org/images/ls-logo.jpg" border="0"/> |
| </a> |
| </td> |
| <td align="right"> |
| <a href="http://logging.apache.org/log4j/docs/"> |
| <img src="./images/logo.jpg" alt="The log4j project" border="0"/> |
| </a> |
| </td> |
| </tr> |
| </table> |
| <!-- END Header table --> |
| |
| <div class="centercol"> |
| <hr noshade="" size="1"/> |
| |
| <h1>Introduction</strong></h1> |
| <p>Inserting log statements into your code is a low-tech method |
| for debugging it. It may also be the only way because |
| debuggers are not always available or applicable. This is |
| often the case for distributed applications.</p> |
| <p>On the other hand, some people argue that log statements |
| pollute source code and decrease legibility. (We believe that |
| the contrary is true). In the Java language where a |
| preprocessor is not available, log statements increase the |
| size of the code and reduce its speed, even when logging is |
| turned off. Given that a reasonably sized application may |
| contain thousands of log statements, speed is of particular |
| importance.</p> |
| <p>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.</p> |
| <p>Logging equips the developer with <i>detailed context</i> 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.</p> |
| <p>One of the distinctive features of log4j is the notion of |
| <i>inheritance</i> in loggers. Using a logger |
| <em>hierarchy</em> 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.</p> |
| <p>The target of the log output can be a file, an |
| <code>OutputStream</code>, a <code>java.io.Writer</code>, a |
| remote log4j server, a remote Unix Syslog daemon, or even a NT |
| Event logger among many other output targets.</p> |
| <p>On an AMD Duron clocked at 800Mhz running JDK 1.3.1, it costs |
| about 5 nanoseconds to determine if a logging statement should |
| be logged or not. Actual logging is also quite fast, ranging |
| from 21 microseconds using the SimpleLayout, 37 |
| microseconds using the TTCCLayout. The performance of the |
| PatternLayout is almost as good as the dedicated layouts, |
| except that it is much more flexible.</p> |
| <p>The package is being constantly improved thanks to input from |
| users and code contributed by authors in the community. |
| </p> |
| |
| |
| |
| <hr/> |
| |
| |
| |
| |
| |
| <!-- FOOTER --> |
| <div align="center"><font color="#525D76" size="-1"><em> |
| Copyright © 1999-2004, Apache Software Foundation |
| </em></font></div> |
| |
| <!-- END main table --> |
| |
| <!-- LEFT SIDE NAVIGATION --> |
| <!-- ============================================================ --> |
| <div class="leftcol"> |
| <div class="menu_header">Log4j Project</div> |
| <div class="menu_item"> <a href="./index.html">Introduction</a> |
| </div> |
| <div class="menu_item"> <a href="./download.html">Download</a> |
| </div> |
| <div class="menu_item"> <a href="./documentation.html">Documentation</a> |
| </div> |
| <div class="menu_item"> <a href="./chainsaw.html">Chainsaw</a> |
| </div> |
| <div class="menu_item"> <a href="./ugli.html">UGLI</a> |
| </div> |
| <div class="menu_item"> <a href="./history.html">History</a> |
| </div> |
| <div class="menu_header">Support</div> |
| <div class="menu_item"> <a href="http://logging.apache.org/site/binindex.cgi">Binary distributions</a> |
| </div> |
| <div class="menu_item"> <a href="http://logging.apache.org/site/cvs-repositories.html">CVS Repositories</a> |
| </div> |
| <div class="menu_item"> <a href="http://logging.apache.org/site/mailing-lists.html">Mailing Lists</a> |
| </div> |
| <div class="menu_item"> <a href="http://logging.apache.org/site/bugreport.html">Bug Reporting</a> |
| </div> |
| <div class="menu_header">Translations</div> |
| <div class="menu_item"> <a href="http://jakarta.apache-korea.org/log4j/index.html">Korean</a> |
| </div> |
| <div class="menu_item"> <a href="http://www.ingrid.org/jajakarta/log4j/">Japanese</a> |
| </div> |
| </div> |
| |
| |
| </body> |
| </html> |
| <!-- end the processing --> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |