You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-cvs@jakarta.apache.org by ce...@apache.org on 2001/11/29 00:00:42 UTC

cvs commit: jakarta-log4j/src/docbook configuration.xml

ceki        01/11/28 15:00:41

  Modified:    src/docbook configuration.xml
  Log:
  Enhanced docs.
  
  Revision  Changes    Path
  1.17      +79 -10    jakarta-log4j/src/docbook/configuration.xml
  
  Index: configuration.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/docbook/configuration.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- configuration.xml	2001/11/26 23:55:36	1.16
  +++ configuration.xml	2001/11/28 23:00:41	1.17
  @@ -87,7 +87,7 @@
         </programlisting>
       </para>
   
  -  <para>The invocation of the <ulink
  +    <para>The invocation of the <ulink
         url="../api/org/apache/log4j/BasicConfigurator.html#configure()">BasicConfigurator.configure</ulink>
         method creates a rather simple log4j setup. This method is
         hardwired to add to the root logger a <ulink
  @@ -276,6 +276,75 @@
     </sect1>
   
     <!-- ================================================================ -->
  +  <!-- Filtering by request level (PropertyConfigurator)                -->
  +  <!-- ================================================================ -->
  +
  +  <sect1>
  +    <title>Filtering by repository-wide threshold
  +      (<classname>PropertyConfigurator</classname>)</title>
  +    
  +    <para>The fastest but the least flexible way of filtering logging
  +    output is by setting a repository-wide threshold. This approach
  +    was explained in <xref linkend="repositoryThreshold"/>. It is quite easy to set
  +    the repository wide threshold in properties file. Below is an exaple.
  +    </para>
  +
  +
  +    <para>
  +      <screen>
  +
  +log4j.rootLogger=DEBUG, A1
  +log4j.appender.A1=org.apache.log4j.ConsoleAppender
  +log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  +  
  +log4j.appender.A1.layout.ConversionPattern=[%t] %-5p %c - %m%n
  +  
  +# Print only messages of priority WARN or above regardless of the logger.
  +<emphasis role="bold">log4j.threshold=WARN</emphasis>
  +      </screen>
  +    </para>
  +
  +    <para>Since <classname>MyApp</classname> does not contain any
  +      warning, error or fatal log requests, all logging is surpressed.
  +    </para>
  +  </sect1>
  +
  +  <!-- ================================================================ -->
  +  <!-- Filtering by request level (DOMConfigurator)                     -->
  +  <!-- ================================================================ -->
  +
  +  <sect1>
  +    <title>Filtering by logger and by request level (<classname>DOMConfigurator</classname>)</title>
  +    
  +    <para>
  +      <example><title>XML equivalent configuration file</title>
  +	<screen>
  +  &lt;?xml version="1.0" encoding="UTF-8" ?>
  +  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  +	  
  +  &lt;log4j:configuration <emphasis role="bold">threshold="WARN"</emphasis>  xmlns:log4j='http://jakarta.apache.org/log4j/'>
  +	  
  +	&lt;appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
  +           &lt;layout class="org.apache.log4j.PatternLayout">
  +             &lt;param name="ConversionPattern"
  +		    value="[%t] %-5p %c - %m%n"/>
  +           &lt;/layout>	    
  +	&lt;/appender>
  +
  +	  
  +	&lt;root>
  +	   &lt;priority value ="debug" />
  +   	   &lt;appender-ref ref="STDOUT" />
  +	&lt;/root>
  +	
  +&lt;/log4j:configuration>
  +
  +      </screen>
  +      </example>
  +    </para>    
  +  </sect1>
  +
  +  <!-- ================================================================ -->
     <!-- Filtering by logger and by request level (PropertyConfigurator)  -->
     <!-- ================================================================ -->
   
  @@ -286,12 +355,11 @@
       <para>As was mentioned earlier, one the important features of any
         logging library is its support for filtering logging messages
         depending on various criteria. In a very common scenario, the
  -      user will want to filter out requests depending on the logger
  -      and the request level. Note that if you name loggers by class
  -      name then filtering by logger is equivalent to filtering by
  -      class name which is usually closely related to the software
  -      component. In the following sections we will discuss more
  -      general but less efficient ways of filtering.
  +      user will want to filter out requests by logger and request
  +      level. Note that if you name loggers by class name then
  +      filtering by logger is equivalent to filtering by class. The
  +      class is in turn usually closely related to the software
  +      component. 
       </para>
   
       <para>Suppose we are no longer interested in seeing any INFO or
  @@ -689,15 +757,16 @@
       configuration files</title>
       
       
  -    <para>Log4j configuration is the responsibility of the end-user or
  +    <para>Configuring log4j is the responsibility of the end-user or
       generally the application deployer. Whenever possible, a library
       should not try to configure logging but leave it to the
       deployer. After all, logging output is useful only if someone will
       take the time to look at them. If the end-user wishes to log then
       she should control the logging configuration. Nevertheless, it is
  -    very helpful if the library develop-per provides documentation on
  -    logging preferably with working examples.
  +    helpful if the library develop-per provides documentation on
  +    logging, preferably with working examples.
       </para>
  +  </sect1>
   
     <sect1>
       <title>SMTPAppender</title>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>