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/22 22:03:41 UTC

cvs commit: jakarta-log4j/src/java/org/apache/log4j/xml DOMConfigurator.java

ceki        01/11/22 13:03:41

  Modified:    src/docbook configuration.xml faq.xml glossary.xml
                        manual.xml trouble.xml
               src/java/org/apache/log4j Level.java Logger.java
                        Priority.java
               src/java/org/apache/log4j/xml DOMConfigurator.java
  Log:
  - Removed the Fine level. This was sure to create headaches in the future.
  
  - Docu enhancements.
  
  - Added doConfigure(Element, LoggerRepository) to DOMConfigurator
  
  Revision  Changes    Path
  1.15      +106 -92   jakarta-log4j/src/docbook/configuration.xml
  
  Index: configuration.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/docbook/configuration.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- configuration.xml	2001/11/18 22:10:35	1.14
  +++ configuration.xml	2001/11/22 21:03:41	1.15
  @@ -113,6 +113,17 @@
       after just having called the <classname>BasicConfigurator.configure</classname>
       method. </para>
   
  +    <mediaobject>
  +      <imageobject> 
  +	<imagedata fileref="od.gif" format="gif"/> 
  +      </imageobject>
  +      <textobject> <phrase>A bunch of rectangles</phrase> </textobject>
  +      <caption>
  +	<para>Here are a bunch of rectangles</para>
  +      </caption>
  +    </mediaobject>
  +
  +
     <para>
       <!-- <img src="od.gif" align="center"/> -->
     </para>
  @@ -261,8 +272,8 @@
     </sect1>
   
     <sect1>
  -    <title><classname>PropertyConfigurator</classname>: Filtering by
  -      logger and request level</title>
  +    <title>Filtering by logger and by request level
  +      <classname>PropertyConfigurator</classname></title>
   
       <para>As was mentioned earlier, one the important features of any
         logging library is its support for filtering logging messages
  @@ -300,22 +311,23 @@
   
   <screen>
   <emphasis role="bold">2000-09-07 14:07:41,508</emphasis> [main] INFO MyApp - Entering
  -application.  <emphasis role="bold">2000-09-07 14:07:41,529</emphasis> [main] INFO
  -MyApp - Exiting application.
  +application.  
  +<emphasis role="bold">2000-09-07 14:07:41,529</emphasis> [main] INFO MyApp - Exiting application.
     </screen>
   
  -  <para>As the logger <classname>com.foo.Bar</classname> does not have an
  -    assigned priority, it inherits its priority from
  -    <classname>com.foo</classname>, which was set to WARN in the configuration
  -    file. The log statement from the <classname>Bar.doIt</classname> method has
  -    the priority DEBUG, lower than the logger priority
  -    WARN. Consequently, <classname>doIt()</classname> method's log request is
  +  <para>As the logger <classname>com.foo.Bar</classname> does not have
  +    an assigned priority, it inherits its priority from
  +    <classname>com.foo</classname>, which was set to WARN in the
  +    configuration file. The log statement from the
  +    <classname>Bar.doIt</classname> method has the priority DEBUG,
  +    lower than the logger priority WARN. Consequently, the log request
  +    from the <classname>doIt()</classname> method is
       suppressed.</para>
   
     </sect1>
     
     <sect1>
  -    <title><classname>DOMConfigurator</classname>: Filtering by logger level</title>
  +    <title>Filtering by logger and by request level (<classname>DOMConfigurator</classname>)</title>
       
       <para>
         <example><title>XML equivalent configuration file</title>
  @@ -332,9 +344,9 @@
              &lt;/layout>	    
   	&lt;/appender>
   
  -        &lt;logger name="com.foo">
  +        <emphasis role="bold">&lt;logger name="com.foo">
              &lt;level value=WARN">
  -        &lt;/logger>
  +        &lt;/logger></emphasis>
   	
   	&lt;root>
   	   &lt;priority value ="debug" />
  @@ -348,6 +360,87 @@
       </para>    
     </sect1>
   
  +  <sect1 id="thresholdFiltering">
  +    <title>Filtering by Appender and by request level
  +    (<classname>(PropertyConfigutaor</classname>)</title>
  +
  +    <para>Setting the <emphasis role="bold">Threshold</emphasis> option
  +      of any appender extending AppenderSkeleton, (most log4j
  +      appenders extend AppenderSkeleton) to filter out all log events
  +      with lower priority than the value of the threshold option.
  +    </para>
  +
  +    <para>For example, setting the threshold of an appender to DEBUG
  +      also allow INFO, WARN, ERROR and FATAL messages to log along
  +      with DEBUG messages. (DEBUG is the lowest level). This is
  +      usually acceptable as there is little use for DEBUG messages
  +      without the surrounding INFO, WARN, ERROR and FATAL
  +      messages. Similarly, setting the threshold of an appender to
  +      ERROR will filter out DEBUG, INFO and ERROR messages but not
  +      FATAL messages. This policy usually best encapsulates what the
  +      user actually wants to do, as opposed to her mind-projected
  +      solution.
  +    </para>
  +    
  +    <para>See sort4.lcf for an example threshold configuration. </para>
  +
  +    <programlisting>
  +
  +# Set root logger priority to DEBUG and its only appender to A1.
  +log4j.rootLogger=DEBUG, A1
  +  
  +# A1 is set to be a ConsoleAppender. 
  +log4j.appender.A1=org.apache.log4j.ConsoleAppender
  +
  +log4j.appender.A1.Threshold=INFO
  +  
  +# A1 uses PatternLayout.
  +log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n       
  +    </programlisting>
  +    
  +    <para>Running <classname>MyApp2</classname> with the this
  +    configuration scripts yields the following output on the screen.
  +    </para>
  +
  +    <screen>
  +0    [main] INFO  MyApp  - Entering application.
  +51   [main] INFO  MyApp  - Exiting application.
  +    </screen>
  +
  +    <para>If you must filter events by exact level match, then you can
  +      attach a LevelMatchFilter to any appender to filter out logging
  +      events by exact level match.</para>
  +  </sect1>
  +
  +  <sect1>
  +    <title>Filtering by Appender and by request level
  +    (<classname>DOMConfigurator</classname>)</title>
  +    
  +    <para>The following XML file has the same effect as the key=value
  +    configuration file listed previously.</para>
  +
  +    <programlisting>
  + &lt;?xml version="1.0" encoding="UTF-8" ?>
  +  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  +	  
  +  &lt;log4j:configuration 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="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
  +      &lt;param name="Threshold" value="INFO"/>
  +    &lt;/layout>	                 
  +  &lt;/appender>
  +
  + &lt;root>
  +   &lt;priority value ="debug" />
  +   &lt;appender-ref ref="STDOUT" />
  + &lt;/root>
  +	
  +&lt;/log4j:configuration>
  +    </programlisting>
  +  </sect1>
   
     <sect1>
       <title>Multiple appenders (<classname>PropertyConfigurator</classname>)</title>
  @@ -443,85 +536,6 @@
       </para>    
     </sect1>
         
  -  <sect1 id="thresholdFiltering">
  -    <title>PropertyConfigutaor: Level-based filters on Appenders</title>
  -
  -    <para>Setting the <emphasis role="bold">Threshold</emphasis> option
  -      of any appender extending AppenderSkeleton, (most log4j
  -      appenders extend AppenderSkeleton) to filter out all log events
  -      with lower priority than the value of the threshold option.
  -    </para>
  -
  -    <para>For example, setting the threshold of an appender to DEBUG
  -      also allow INFO, WARN, ERROR and FATAL messages to log along
  -      with DEBUG messages. (DEBUG is the lowest level). This is
  -      usually acceptable as there is little use for DEBUG messages
  -      without the surrounding INFO, WARN, ERROR and FATAL
  -      messages. Similarly, setting the threshold of an appender to
  -      ERROR will filter out DEBUG, INFO and ERROR messages but not
  -      FATAL messages. This policy usually best encapsulates what the
  -      user actually wants to do, as opposed to her mind-projected
  -      solution.
  -    </para>
  -    
  -    <para>See sort4.lcf for an example threshold configuration. </para>
  -
  -    <programlisting>
  -
  -# Set root logger priority to DEBUG and its only appender to A1.
  -log4j.rootLogger=DEBUG, A1
  -  
  -# A1 is set to be a ConsoleAppender. 
  -log4j.appender.A1=org.apache.log4j.ConsoleAppender
  -
  -log4j.appender.A1.Threshold=INFO
  -  
  -# A1 uses PatternLayout.
  -log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n       
  -    </programlisting>
  -    
  -    <para>Running <classname>MyApp2</classname> with the this
  -    configuration scripts yields the following output on the screen.
  -    </para>
  -
  -    <screen>
  -0    [main] INFO  MyApp  - Entering application.
  -51   [main] INFO  MyApp  - Exiting application.
  -    </screen>
  -
  -    <para>If you must filter events by exact level match, then you can
  -      attach a LevelMatchFilter to any appender to filter out logging
  -      events by exact level match.</para>
  -  </sect1>
  -
  -  <sect1>
  -    <title>DOMConfigurator: Level-based filters on Appenders</title>
  -    
  -    <para>The following XML file has the same effect as the key=value
  -    configuration file listed previously.</para>
  -
  -    <programlisting>
  - &lt;?xml version="1.0" encoding="UTF-8" ?>
  -  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  -	  
  -  &lt;log4j:configuration 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="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
  -      &lt;param name="Threshold" value="INFO"/>
  -    &lt;/layout>	                 
  -  &lt;/appender>
  -
  - &lt;root>
  -   &lt;priority value ="debug" />
  -   &lt;appender-ref ref="STDOUT" />
  - &lt;/root>
  -	
  -&lt;/log4j:configuration>
  -    </programlisting>
  -  </sect1>
   
     <sect1>
       <title>Reloading configuration files</title>
  
  
  
  1.4       +82 -7     jakarta-log4j/src/docbook/faq.xml
  
  Index: faq.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/docbook/faq.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- faq.xml	2001/09/20 22:19:07	1.3
  +++ faq.xml	2001/11/22 21:03:41	1.4
  @@ -36,17 +36,17 @@
   	<para>
   	  The two APIs are very similar. As a result of <ulink
   	url="http://jakarta.apache.org/log4j/docs/critique.html">our
  -	campaign</ulink> to influence and improve the JSR47 API, in
  -	its next revision JSR47 will resemble log4j even more closely.
  +	campaign</ulink> to influence and improve the JSR47 API, the
  +	final version of JSR47 resembles log4j even more closely.
   	</para>
   
   	<para>
   	  There are two critical differences between the APIs. First,
  -	JSR47 requires JDK 1.4 whereas log4j is compatible with JDK
  -	1.1 and later. Second, log4j offers much more
  -	functionality. It supports a rich configuration language, at
  -	least a dozen appenders and layouts as well as many other
  -	useful features.
  +	  JSR47 requires JDK 1.4 whereas log4j is compatible with JDK
  +	  1.1 and later. Second, log4j offers much more
  +	  functionality. It supports a rich configuration language, at
  +	  least a dozen appenders and layouts as well as many other
  +	  useful features.
   	</para>
   
         </answer>
  @@ -55,6 +55,80 @@
   
       <qandaentry>
         <question>
  +	<para>How do log to different files based on level?</para>
  +      </question>
  +      <answer>
  +	<para>
  +	  Yes it is. Setting the <emphasis
  +	  role="bold">Threshold</emphasis> property of any appender
  +	  extending <link
  +	  url="../api/org/apache/log4j/AppenderSkeleton.html">AppenderSkeleton</link>
  +	  (most log4j appenders extend AppenderSkeleton) will filter
  +	  out all log requests with a level lower than the value of
  +	  the threshold property.</para>
  +
  +	<para>For example, setting the threshold of an appender to
  +	  DEBUG will log INFO, WARN, ERROR and FATAL messages along
  +	  with DEBUG messages. (DEBUG is the lowest level). This is
  +	  usually acceptable as there is little use for DEBUG messages
  +	  without the surrounding INFO, WARN, ERROR and FATAL
  +	  messages. Similarly, setting the threshold of an appender to
  +	  ERROR will filter out DEBUG, INFO and ERROR messages but not
  +	  FATAL messages. This policy usually best encapsulates what
  +	  the user actually wants to do, as opposed to her
  +	  mind-projected solution.
  +	</para>
  +	
  +	<example>
  +	  <title><classname>PropertyConfigurator</classname></title>
  +	  <programlisting>
  +	    # Attach appender A1 to root. Set root priority to Level.DEBUG.
  +	    log4j.rootCategory=DEBUG, A1, A2
  +
  +	    # A1 is set to be a ConsoleAppender. However, it will only print 
  +            # error messages or higher since the threshold is set to Level.ERROR.
  +
  +	    # Note that setting the level of the root logger to to Level.DEBUG only
  +	    # influences log requests made to the root logger. It has no
  +	    # influence on the appenders attached to root.
  +	    
  +	    log4j.appender.A1=org.apache.log4j.ConsoleAppender
  +	    <emphasis role="bold">log4j.appender.A1.Threshold=ERROR</emphasis>
  +	    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  +	    log4j.appender.A1.layout.ConversionPattern=%p [%t] %c{2} (%M:%L) - %m%n
  +	  </programlisting>
  +	</example>
  + 
  +	<example>
  +	  <title><classname>DOMConfigurator</classname></title>
  +	  <programlisting>
  +	    &lt;?xml version="1.0" encoding="UTF-8" ?>
  +	    &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
  +	    
  +	    &lt;log4j:configuration 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="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
  +  	           &lt;param name="Threshold" value="INFO"/>
  +   	        &lt;/layout>	                 
  +	      &lt;/appender>
  +	    
  +	      &lt;root>
  +	        &lt;priority value ="debug" />
  +	        &lt;appender-ref ref="STDOUT" />
  +	      &lt;/root>
  +	
  +	    &lt;/log4j:configuration>
  +    	  </programlisting>
  +	</example>
  +
  +	
  +      </answer>
  +    </qandaentry>
  +
  +    <qandaentry>
  +      <question>
   	<para>Why was the <classname>Category</classname> class renamed
   	  as <classname>Logger</classname> and the
   	  <classname>Priority</classname> class to
  @@ -70,6 +144,7 @@
   	</para>
         </answer>
       </qandaentry>
  +
       
   
     </qandaset>   
  
  
  
  1.6       +7 -6      jakarta-log4j/src/docbook/glossary.xml
  
  Index: glossary.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/docbook/glossary.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- glossary.xml	2001/10/14 16:06:52	1.5
  +++ glossary.xml	2001/11/22 21:03:41	1.6
  @@ -9,12 +9,13 @@
     <glossentry id="gloss-printingMethods">
       <glossterm>Logger Printing Methods</glossterm>
       <glossdef>
  -      <para>Methods defined in the <ulink
  -	  url="../api/org/apache/log4j/Logger.html">Logger</ulink>
  -	  class such as such as <function>debug</function>,
  -	  <function>info</function>, <function>warn</function>,
  -	  <function>error</function>, <function>fatal</function> and
  -	  <function>log</function>.
  +      <para>The logger printing methods are
  +	<function>debug</function>, <function>info</function>,
  +	<function>warn</function>, <function>error</function>,
  +	<function>fatal</function> and <function>log</function>
  +	methods as defined in the <ulink
  +	url="../api/org/apache/log4j/Logger.html">Logger</ulink>
  +	class.
         </para>
       </glossdef>
     </glossentry>
  
  
  
  1.16      +1 -1      jakarta-log4j/src/docbook/manual.xml
  
  Index: manual.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/docbook/manual.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- manual.xml	2001/11/18 22:10:35	1.15
  +++ manual.xml	2001/11/22 21:03:41	1.16
  @@ -42,7 +42,7 @@
     &wider;
     &changes;
     &faq;
  - <!-- &trouble; -->
  +  &trouble;
     &glo;
   
   </book>
  
  
  
  1.5       +181 -186  jakarta-log4j/src/docbook/trouble.xml
  
  Index: trouble.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/docbook/trouble.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- trouble.xml	2001/09/28 13:37:47	1.4
  +++ trouble.xml	2001/11/22 21:03:41	1.5
  @@ -8,83 +8,84 @@
         url="http://www.tuxedo.org/~esr/faqs/smart-questions.html">asking
         questions the smart way</ulink>.    
     </para>
  -  <qandaset>
  -    
  +
  +
  +  <qandaset>    
  +
       <qandaentry>
         <question>
   	<para>Log4j tells me to initialize properly.</para>
         </question>
         <answer>
  -	  <para>
  -	    Logging output is written to a target by using an appender. If no
  -	    appenders are attached to a category nor to any of its ancestors, you
  -	    will get the following message when trying to log:
  -	  </para>
  +	<para>
  +	  Logging output is written to a target by using an appender. If no
  +	  appenders are attached to a category nor to any of its ancestors, you
  +	  will get the following message when trying to log:
  +	</para>
   	  
  -	    <screen>
  +	<screen>
   log4j:WARN No appenders could be found for category (some.category.name).
   log4j:WARN Please initialize the log4j system properly.
  -	    </screen>
  +	</screen>
   	    
  -	  <para><emphasis>Log4j does not have a default logging
  -	      target.</emphasis> It is the user's responsibility to
  -	      ensure that all categories can inherit an appender.
  -	      This can be easily achieved by attaching an appender to
  -	      the root category.
  -	  </para>
  -	</answer>
  -      </qandaentry>
  -
  -      <qandaentry>
  +	<para><emphasis>Log4j does not have a default logging
  +	    target.</emphasis> It is the user's responsibility to
  +	  ensure that all categories can inherit an appender.
  +	  This can be easily achieved by attaching an appender to
  +	  the root category.
  +	</para>
  +      </answer>
  +    </qandaentry>
  +    
  +    <qandaentry>
         <question>
  -	  <para>Duplicates in log4j output.</para>
  -	</question>
  -
  -	<answer>
  -	  
  -	  <para>The reason for observing duplicates in log4j output is
  -	    either due to having added the same appender multiple
  -	    times to the same logger (typically root) or having
  -	    added the same appender to different categories ignoring
  -	    the fact that appenders are inherited cumulatively.
  -	  </para>
  -
  -	  <para>Log4j does not eliminate appender duplicates. In other
  -	    words, if you add the same appender to a logger
  -	    <emphasis>n</emphasis> times, that appender will be
  -	    invoked <emphasis>n</emphasis> times to append to its
  -	    target.
  +	<para>Duplicates in log4j output.</para>
  +      </question>
  +      
  +      <answer>	
  +	<para>The reason for observing duplicates in log4j output is
  +	  either due to having added the same appender multiple times
  +	  to the same logger (typically root) or having added the same
  +	  appender to different categories ignoring the fact that
  +	  appenders are inherited cumulatively.
   	  </para>
   
  -	  <para>A slightly different cause is adding different
  -	    appenders all sharing the same underlying output target to
  -	    some logger. In the most common occurrence of this
  -	    phenomenon, the BasicConfigurator.configure() method is
  -	    invoked multiple times. Each time it is invoked, this
  -	    method adds an appender with a
  -	    <function>System.out</function> target to the root
  -	    logger.</para>
  -
  -	  <para>One other common mistake is to forget that appenders
  -	    are inherited cumulatively from the hierarchy. For
  -	    example, if you add an appender, say
  -	    <function>A</function>, to the root logger, all other
  -	    categories will inherit <function>A</function> as an
  -	    appender. Thus, if you add <function>A</function> to a
  -	    logger, say <function>L</function>, then an enabled
  -	    statement of logger <function>L</function>, will print to
  -	    <function>A</function> twice, once because
  -	    <function>A</function> is in root and once because it is
  +	<para>Log4j does not eliminate appender duplicates. In other
  +	  words, if you add the same appender to a logger
  +	  <emphasis>n</emphasis> times, that appender will be
  +	  invoked <emphasis>n</emphasis> times to append to its
  +	  target.
  +	</para>
  +	
  +	<para>A slightly different cause of trouble is adding
  +	  different appenders all sharing the same underlying output
  +	  target to some logger. In the most common occurrence of
  +	  this phenomenon, the BasicConfigurator.configure() method
  +	  is invoked multiple times. Each time it is invoked, this
  +	  method adds an appender with a
  +	  <function>System.out</function> target to the root
  +	  logger.
  +	</para>
  +	
  +	<para>One other common mistake is to forget that appenders
  +	  are inherited cumulatively from the hierarchy. For
  +	  example, if you add an appender, say
  +	  <function>A</function>, to the root logger, all other
  +	  categories will inherit <function>A</function> as an
  +	  appender. Thus, if you add <function>A</function> to a
  +	  logger, say <function>L</function>, then an enabled
  +	  statement of logger <function>L</function>, will print to
  +	  <function>A</function> twice, once because
  +	  <function>A</function> is in root and once because it is
   	    in <function>L</function>.
  -	  </para>
  -
  -	</answer>
  -      </qandaentry>
  +	</para>	
  +      </answer>
  +    </qandaentry>
   
       <qandaentry>
         <question>
   	<para>Deadlocks occurring after the introduction of log
  -	statements into an application.</para>
  +	  statements into an application.</para>
         </question>
         
         <answer>
  @@ -93,157 +94,151 @@
   	  code. However, without exception the bug was always in the
   	  application code not in log4j. This is not to say that log4j
   	  is totally bug-free but you need to provide some proof
  -	  before jumping to conclusions.
  +	  before accusing log4j and jumping to conclusions.
   	</para>
   	
   	<para>In the typical case, the introduction of logging
  -	statements reveals <emphasis>existing</emphasis> concurrency
  -	problems because log statements add delay which may change the
  -	order of execution among threads, causing an existing
  -	concurrency problem to surface.
  +	  statements reveals <emphasis>existing</emphasis> concurrency
  +	  problems because log statements add delay which may change
  +	  the order of execution among threads, causing an existing
  +	  concurrency problem to come to surface.
   	</para>
  -      </answer>
  -      
  +      </answer>      
       </qandaentry>
   
  -      <qandaentry>
  -	<question>
  -	  <para>Caller location information is printed as a "?"
  -	    character.</para>
  -	</question>
  -
  -	<answer>
  -	  <para>Location information is extracted automatically by the
  -	    PatternLayout conversion patterns %C, %F, %M and
  -	    %L. However, some just-in-time (JIT) compilers make it
  -	    impossible to extract location information. It is also
  -	    possible that the compiler that generated the byte code
  -	    may have omitted the LineNumber table as is done by -O
  -	    option of javac and jikes.
  -	  </para>
  +    <qandaentry>
  +      <question>
  +	<para>Caller location information is printed as a "?"
  +	  character.</para>
  +      </question>
  +      
  +      <answer>
  +	<para>Location information is extracted automatically by the
  +    PatternLayout conversion patterns %C, %F, %M and %L. However, some
  +    just-in-time (JIT) compilers make it impossible to extract
  +    location information. It is also possible that the compiler that
  +    generated the byte code may have omitted the LineNumber table as
  +    is done by -O option of javac and jikes.
  +	</para>
   
  -	  <para>You can remedy this problem by disabling the JIT compiler and by
  -	    compiling the code without the -O option.
  +	<para>You can remedy this problem by disabling the JIT
  +    compiler and by compiling the code without the -O option.
   	  </para>
   
  -	  <para>Wrappers or subclasses of Logger constiture a special
  -	  case.</para>
  +	<para>Wrappers or subclasses of Logger constiture a special
  +	case.
  +	</para>
   
  -	  <para>Wrappers or subclasses of <function>Logger</function>
  -	    need supply their fully qualified class name to the
  -	    <function>Logger.log</function> method or to
  -	    <function>Logger.forcedLog</function> methods so that the
  -	    caller location information can be extracted correctly.
  -	  </para>
  +	<para>Wrappers or subclasses of <function>Logger</function>
  +    need supply their fully qualified class name to the
  +    <function>Logger.log</function> method or to
  +    <function>Logger.forcedLog</function> methods so that the caller
  +    location information can be extracted correctly.
  +	</para>
   
  -	  <para>This approach will work correctly in all cases except
  -	    if the class invoking the extended logger instance has the
  -	    same prefix as the extended logger class. For example,
  -	    calling an instance of
  -	    <function>com.foo.BarLogger</function> from the
  -	    <function>com.foo.BarLoggerTest</function> class will not
  -	    yield the correct caller information. To circumvent this
  -	    "bug", either perform the tests from a class with a
  -	    different name or add a dot to the fully qualified name of
  -	    the extending class that you supply to
  -	    <function>Loggerlog</function> to
  -	    <function>Logger.forcedLog</function> methods. For the
  -	    <function>com.foo.BarLogger</function> example, supply the
  -	    string <function>"com.foo.BarLogger."</function>.
  -	  </para>
  +	<para>This approach will work correctly in all cases except if
  +     the class invoking the extended logger instance has the same
  +     prefix as the extended logger class. For example, calling an
  +     instance of <function>com.foo.BarLogger</function> from the
  +     <function>com.foo.BarLoggerTest</function> class will not yield
  +     the correct caller information. To circumvent this "bug", either
  +     perform the tests from a class with a different name or add a dot
  +     to the fully qualified name of the extending class that you
  +     supply to <function>Loggerlog</function> to
  +     <function>Logger.forcedLog</function> methods. For the
  +     <function>com.foo.BarLogger</function> example, supply the string
  +     <function>"com.foo.BarLogger."</function>.
  +	</para>
   
  -	</answer>
  -      </qandaentry>
  +      </answer>
  +    </qandaentry>
   
  -      <qandaentry>
  -	<question>
  -	  <para>
  -	    <function>ClassCastException</function> when instantiating
  -	    <function>Logger</function> subclasses.
  -	  </para>
  -	</question>
  +    <qandaentry>
  +      <question>
  +	<para>
  +	  <function>ClassCastException</function> when instantiating
  +	  <function>Logger</function> subclasses.
  +	</para>
  +      </question>
   
  -	<answer>
  -	  
  -	  <para>This exception is thrown because log4j does not
  -	    support homonyms. For example, the following will
  -	    systematically throw a <function>ClassCastException</function>
  +      <answer>
  +	<para>This exception is thrown because log4j does not support
  +    homonyms. For example, the following will systematically throw a
  +    <function>ClassCastException</function>
   	    <programlisting>
  -	      Logger c1 = Logger.getLogger("bad"); 
  -             MyLogger c2 = (MyLogger) MyLogger.getLogger("bad");
  + 	      Logger c1 = Logger.getLogger("bad"); 
  +              MyLogger c2 = (MyLogger) MyLogger.getLogger("bad");
   	    </programlisting>
  -
  -	    where <function>MyLogger</function> is a subclass of
  -	    <function>Logger</function>. The problem occurs because the
  -	    second <function>getInstance</function> invocation will retrieve
  -	    the Logger created in the fist invocation. This instance
  -	    is a <function>Logger</function> object and cannot be cast to
  -	    <function>MyLogger</function>.  </para>
  -
  -
  -
  -	  <para>By default, the <function>PropertyConfigurator</function> will
  -	    create and configure <function>org.apache.log4j.Logger</function>
  -	    objects. Thus, if you try to instantiate a Logger subclass
  -	    for an already existing logger, and try to cast it to the
  -	    subclass type, you will systematically get a
  -	    <function>ClassCastException</function>.</para>
  -
  -	  <para>To address this problem, the
  -	    <function>PropertyConfigurator</function> admits the
  -	    <function>log4j.loggerFactory</function> key. The value of this
  -	    key will be used as the factory to invoke when
  -	    instantiating Logger objects.</para>
  -
  -	  <para>The <function>DOMConfigurator</function> has a finer grain
  -	    method for setting the class of the logger object to
  -	    instantiate.</para>
  -
  -	</answer>
  -      </qandaentry>
  -
  -
  -      <qandaentry>
  -	<question>
  -	  <para>log4j:WARN No such property [xyz] in some appender or layout</para>
   
  -	</question>
  +    where <function>MyLogger</function> is a subclass of
  +    <function>Logger</function>. The problem occurs because the second
  +    <function>getInstance</function> invocation will retrieve the
  +    Logger created in the fist invocation. This instance is a
  +    <function>Logger</function> object and cannot be cast to
  +    <function>MyLogger</function>.  
  +	</para>
   
  -	<answer>
  +	<para>By default, the <function>PropertyConfigurator</function> will
  +	  create and configure <function>org.apache.log4j.Logger</function>
  +	  objects. Thus, if you try to instantiate a Logger subclass
  +	  for an already existing logger, and try to cast it to the
  +	  subclass type, you will systematically get a
  +	  <function>ClassCastException</function>.</para>
  +	
  +	<para>To address this problem, the
  +	  <function>PropertyConfigurator</function> admits the
  +	  <function>log4j.loggerFactory</function> key. The value of this
  +	  key will be used as the factory to invoke when
  +	  instantiating Logger objects.</para>
  +	
  +	<para>The <function>DOMConfigurator</function> has a finer grain
  +	  method for setting the class of the logger object to
  +	  instantiate.</para>
  +	
  +      </answer>
  +    </qandaentry>
   
  -	  <para>If during log4j configuration you get a warning about
  -	    an inexistent property, then you have probably misspelled
  -	    a property or entered a truly unrecognized property for
  -	    the component you are trying to configure in the
  -	    configuration file.
  -	  </para>
   
  -	  <para>Log4j version 1.0 did not complain about unrecognized
  +    <qandaentry>
  +      <question>
  +	<para>log4j:WARN No such property [xyz] in some appender or layout</para>	
  +      </question>
  +      
  +      <answer>
  +	
  +	<para>If during log4j configuration you get a warning about
  +	  an inexistent property, then you have probably misspelled
  +	  a property or entered a truly unrecognized property for
  +	  the component you are trying to configure in the
  +	  configuration file.
  +	</para>
  +	
  +	<para>Log4j version 1.0 did not complain about unrecognized
   	      properties whereas log4j version 1.1 and later do
  -	      complain.
  -	  </para>
  -	</answer>
  -      </qandaentry>
  -
  -      <qandaentry>
  -	<question>
  -	  <para>I cannot log to syslogd under linux.</para>
  -	</question>
  -
  -	<answer>
  -
  -	  <para>If you are trying to log to the Unix syslog under
  +	  complain.
  +	</para>
  +      </answer>
  +    </qandaentry>
  +    
  +    <qandaentry>
  +      <question>
  +	<para>I cannot log to syslogd under linux.</para>
  +      </question>
  +      
  +      <answer>
  +	
  +	<para>If you are trying to log to the Unix syslog under
   	  Linux using the <ulink
  -	  url="../api/org/apache/log4j/net/SyslogAppender.html">SyslogAppender</ulink>,
  +	    url="../api/org/apache/log4j/net/SyslogAppender.html">SyslogAppender</ulink>,
   	  then the Linux syslog daemon must be configured to accept
   	  log input from the network.  Otherwise, you will get an
   	  <function>IOException: connection refused</function>.
  -	  </para>
  -
  -	  <para>This can be done by adding the <function>-r</function> option when starting
  -	    the daemon. Or more precisely:</para>
  -
  -	  <orderedlist>
  +	</para>
  +	
  +	<para>This can be done by adding the <function>-r</function> option when starting
  +	  the daemon. Or more precisely:</para>
  +	
  +	<orderedlist>
   	    <listitem>
   	      <para>Login as the <function>root</function> user</para>
   	    </listitem>
  
  
  
  1.4       +1 -1      jakarta-log4j/src/java/org/apache/log4j/Level.java
  
  Index: Level.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Level.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Level.java	2001/10/22 23:08:59	1.3
  +++ Level.java	2001/11/22 21:03:41	1.4
  @@ -88,7 +88,7 @@
   
       if(s.equals("ALL")) return Level.ALL; 
       if(s.equals("DEBUG")) return Level.DEBUG; 
  -    if(s.equals("FINE")) return Level.FINE; 
  +    //if(s.equals("FINE")) return Level.FINE; 
       if(s.equals("INFO"))  return Level.INFO;
       if(s.equals("WARN"))  return Level.WARN;  
       if(s.equals("ERROR")) return Level.ERROR;
  
  
  
  1.9       +15 -15    jakarta-log4j/src/java/org/apache/log4j/Logger.java
  
  Index: Logger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Logger.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Logger.java	2001/11/17 01:04:21	1.8
  +++ Logger.java	2001/11/22 21:03:41	1.9
  @@ -68,14 +68,14 @@
       Throwable)} form instead.
       
       @param message the message object to log. */
  -  public
  -  void fine(Object message) {
  -    if(repository.isDisabled(Level.DEBUG_INT)) 
  -      return;    
  -    if(Level.DEBUG.isGreaterOrEqual(this.getChainedLevel())) {
  -      forcedLog(FQCN, Level.DEBUG, message, null);
  -    }
  -  }
  +  //public
  +  //void fine(Object message) {
  +  //  if(repository.isDisabled(Level.DEBUG_INT)) 
  +  //	return;    
  +  //  if(Level.DEBUG.isGreaterOrEqual(this.getChainedLevel())) {
  +  //	forcedLog(FQCN, Level.DEBUG, message, null);
  +  //  }
  +  //}
     
   
     /**  
  @@ -87,13 +87,13 @@
      
      @param message the message object to log.
      @param t the exception to log, including its stack trace.  */  
  -  public
  -  void fine(Object message, Throwable t) {
  -    if(repository.isDisabled(Level.DEBUG_INT)) 
  -      return;
  -    if(Level.DEBUG.isGreaterOrEqual(this.getChainedLevel()))
  -      forcedLog(FQCN, Level.FINE, message, t);    
  -  }
  +  //public
  +  //void fine(Object message, Throwable t) {
  +  //  if(repository.isDisabled(Level.DEBUG_INT)) 
  +  //	return;
  +  //  if(Level.DEBUG.isGreaterOrEqual(this.getChainedLevel()))
  +  //	forcedLog(FQCN, Level.FINE, message, t);    
  +  //}
   
     /**
        Same as calling {@link LogManager#getLogger(String)}.
  
  
  
  1.18      +2 -2      jakarta-log4j/src/java/org/apache/log4j/Priority.java
  
  Index: Priority.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/Priority.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Priority.java	2001/10/22 23:08:59	1.17
  +++ Priority.java	2001/11/22 21:03:41	1.18
  @@ -27,7 +27,7 @@
     public final static int WARN_INT  = 30000;
     public final static int INFO_INT  = 20000;
     public final static int DEBUG_INT = 10000;
  -  public final static int FINE_INT = DEBUG_INT;
  +    //public final static int FINE_INT = DEBUG_INT;
     public final static int ALL_INT = Integer.MIN_VALUE;
   
   
  @@ -62,7 +62,7 @@
     /**
        The <code>FINE</code> level is an alias for the
        <code>DEBUG</code> level.  */
  -  final static public Level FINE = new Level(FINE_INT, "FINE", 7);
  +    //final static public Level FINE = new Level(FINE_INT, "FINE", 7);
   
   
     /**
  
  
  
  1.41      +10 -2     jakarta-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java
  
  Index: DOMConfigurator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/DOMConfigurator.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- DOMConfigurator.java	2001/11/18 12:57:26	1.40
  +++ DOMConfigurator.java	2001/11/22 21:03:41	1.41
  @@ -29,9 +29,9 @@
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.FactoryConfigurationError;
   
  -// Contributors:   Mark Womack <mw...@bevocal.com> 
  +// Contributors:   Mark Womack
  +//                 Arun Katkere 
   
  -
   /**
      Use this class to initialize the log4j environment using a DOM tree.
   
  @@ -674,6 +674,14 @@
         LogLog.error("Could not parse input source ["+inputSource+"].", e);
       }
     }
  +
  +    /**
  +       Configure by taking in an DOM element. 
  +     */
  +    public void doConfigure(Element element, LoggerRepository repository) {
  +	this.repository = repository;
  +	parse(element);
  +    }
   
     
     /**
  
  
  

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