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

v1_3alpha_6 :: 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 as log4j itself is implemented in terms of the
      UGLI interface.
      </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 parametized 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 runtime</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 to use just one implementation, that
        is NOP, Simple, JDK 1.4 logging and log4j, respectively.
        </p>
                                                      <p>Authors of widely-distributed components and librarires 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 and relatively robust approach
        avoids many of the painful bugs associated with dynamic
        discovery processes based on fragile classloader hacks.
        </p>
                                                      <p>Small applications where configuing log4j can be somewhat
        of an overkill can drop in <em>ugli-simple.jar</em> in place
        of <em>log4j.jar</em>. 
        </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>Swappable logging API implementations</td>
            <td>The desired logging API can be plugged in at
            deployment time by insterting the appropriate jar file on
            the classpath.
            </td>
          </tr>

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

            <td>UGLI already 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>UGLI adapters, for all APIs and not just log4j,
            support parametrized log messages.
            </td>
          </tr>


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

            <td>Log4j has built-in support for UGLI. Actually, log4j
            internally makes extensive use of UGLI. The
            <code>Logger</code> class in log4j directly implements
            UGLI's <code>ULogger</code> interface. Moreover, all log4j
            components fallback on <code>SimpleLogger</code>
            implementation for log messages genereted internally by
            log4j in case of incorrect configuration.
            </td>
          </tr>

          <tr>
            <td>Simplicity</td>
            <td>
              <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>Just as importantly, UGLI does not rely on any
              classloader tricks. Every variant of
              <em>ugli-&lt;impl&gt;.jar</em> is hardwired to use one
              specific implementation.</p>
            </td>

            <tr>
              <td>Ease of implemenation</td>

              <td>The simplicity of the UGLI interfaces and the
              deployment model make it easy for developers of other
              logging APIs to easily conform to the UGLI model.
              </td>
            </tr>
          </tr>

          <tr>
            <td>No dynamic discovery</td>
            
            <td>Life is too short to deal with classloader
            hacks.</td>
          </tr>

        </table>
                          
            
  
                                                                                  <hr/>

  
                                                                                                                                                    

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






















[See repo JSON]