The version of Apache log4j used by SoundHelix.

[[ 🗃 ^aEp6o apache-log4j ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/aEp6o

SSH: git clone USERNAME@vervis.peers.community:aEp6o

Branches

Tags

TAG_CHAINSAW2_MOVE :: docs /

ugli.html

<!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="$au.getAttributeValue("email")">
            
            
                                    
                         
            <link href="./css/site.css" rel="stylesheet" type="text/css"/>
                                   

            <title>Log4j project - Universal and Generic Logging Interface (UGLI) </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>Universal and Generic Logging Interface (UGLI)</h1>
                                                      <p>The Universal and Generic Logging Interface or UGLI is
      intended to serve as a simple abstraction of various logging
      APIs allowing to plug in the desired implementation at
      deployment time. Note that log4j version 1.3 and later support
      UGLI directly. Log4j is implemented in terms of the UGLI
      interfaces.
      </p>
                                                      <h2>Typical usage pattern</h2>
                                                      <pre class="source">
 1: <b>import org.apache.ugli.ULogger;</b>
 2: <b>import org.apache.ugli.LoggerFactory;</b>
 3: 
 4: public class Wombat {
 5:  
 6:   <b>final ULogger logger = LoggerFactory.getLogger(Wombat.class);</b>
 7:   Integer t;
 8:   Integer oldT;
 9:
10:   public void setTemperature(Integer temparature) {
11:    
12:     oldT = t;        
13:     t = temperature;
14:
15:     <b>logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);</b>
16:
17:     if(temperature.intValue() &gt; 50) {
18:       <b>logger.info("Temperature has risen above 50 degrees".);</b>
19:     }
20:   }
21: }
      </pre>
                                                      <p>The example above illustrates the typical usage pattern for
      UGLI. Note the use of parameterized log messages on line 15. See
      the question <a href="http://logging.apache.org/log4j/docs/faq.html#2.3">
      "What is the fastest way of (not) logging?"</a> in the log4j
      FAQ for more details.
      </p>
                                                      <h2>Swapping implementations at deployment time</h2>
                                                      <p>UGLI currently supports four implementations, namely, NOP,
        Simple, JDK 1.4 logging and log4j. Log4j 1.3 ships with four
        jar files <em>ugli-nop.jar</em>, <em>ugli-simple.jar</em>,
        <em>ugli-jdk14.jar</em> and <em>log4j.jar</em>. Each of these
        jar files are hardwired <em>at compile-time</em> to use just one 
        implementation,  that is NOP, Simple, JDK 1.4 logging and log4j, 
        respectively.
        </p>
                                                      <p>Small applications where configuring log4j can be somewhat
        of an overkill can drop in <em>ugli-simple.jar</em> in place
        of <em>log4j.jar</em>. 
        </p>
                                                      <p>Authors of widely-distributed components and libraries may
        code against the UGLI interface in order to avoid imposing an
        logging API implementation on the end-user.  At deployment
        time, the end-user may choose the desired logging API
        implementation by inserting the corresponding jar file in her
        classpath. This stupid, simple but robust approach avoids many
        of the painful bugs associated with dynamic discovery
        processes. Life is too short to be spending it hunting down
        class loader problems.
        </p>
                                                      <h2>Simplicity</h2>
                                                      <p>The UGLI interfaces and their various adapters are
        extremely simple. Most developers familiar with the Java
        language should be able to read and fully understand the code
        in less than one hour. 
        </p>
                                                      <p>As noted earlier, UGLI does not rely on any classloader
        tricks. Every variant of <em>ugli-&lt;impl&gt;.jar</em> is
        statically hardwired (at compile time) to use one specific
        implementation. Thus, UGLI suffers none of the <a href="http://www.qos.ch/logging/classloader.jsp">class loader
        problems observed when using JCL</a>.</p>
                                                      <p>We hope that simplicity of the UGLI interfaces and the
        deployment model will make it easy for developers of other
        logging APIs to conform to the UGLI model.
        </p>
                                                      <h2>Built-in support in log4j</h2>
                                                      <p>The <code>Logger</code> class in log4j directly implements
        UGLI's <code>ULogger</code> interface. Moreover, log4j makes
        extensive use of UGLI internally.
        </p>
                                                      <p>Log4j's built-in support for UGLI means that the adapter
        for log4j does not need to wrap log4j objects in order to make
        them conform to UGLI's <code>ULogger</code> interface. A log4j
        <code>Logger</code> <em>is</em> a <code>ULogger</code>. Thus,
        using UGLI in conjunction with log4j involves strictly zero
        memory overhead and near-zero computational overhead. The
        computational overhead is so small as to be unobservable.
        </p>
                                                      <h2>Where can I get UGLI?</h2>
                                                      <p>UGLI ships with log4j version 1.3alpha-6 and later.</p>
                                                      <h2>Summary</h2>
                                                      <table class="ls" cellspacing="4" cellpadding="4">
          <tr>
            <th align="left">Advantage</th>
            <th align="left">Description</th>
          </tr>

          <tr>
            <td>Fail-safe operation</td>
            <td>Assuming the appropriate jar file is available on the
            classpath, under no circumstances will UGLI cause your
            application to fail. This is because no UGLI class loaded
            in memory will <em>ever</em> throw an exception.

            <p>Contrast this with
            <code>LogConfigurationException</code> thrown by
            commons-logging which will cause your otherwise
            functioning application to fail. Commons-logging will
            throw a <code>LogConfigurationException</code> in case the
            <a href="http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/Log.html">Log</a>
            interface and its dynamically discovered implementation
            are loaded by different class loaders.
            </p>
            </td>
          </tr>

          <tr>
            <td>Swappable logging API implementations</td>
            <td>The desired logging API can be plugged in at
            deployment time by inserting the appropriate jar file on
            the classpath.
            </td>
          </tr>

          <tr>
            <td>Adapter implementations for the most popular APIs
            </td>

            <td>UGLI supports the most popular logging APIs, namely
            log4j, JDK 1.4 logging, Simple logging and NOP.
            </td>
          </tr>

          <tr>
            <td>Support for parameterized log messages</td>

            <td>All UGLI adapters support parameterized log messages.</td>
          </tr>

          <tr>
            <td>Built-in support in log4j</td>

            <td>Log4j's built-in support for UGLI directly translates
            into smaller memory footprint and better CPU efficiency.
            </td>
          </tr>
        </table>
                          
            
  
                                                                                                                                        <hr/>

  
                                                                                                                                                                                                                                                                

             
                <!-- FOOTER -->
              <div align="center"><font color="#525D76" size="-1"><em>
                 Copyright &#169; 1999-2005, 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 -->






















[See repo JSON]