You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/12/17 19:35:02 UTC

cvs commit: logging-log4j/tests/input/joran asyncTest.xml

ceki        2004/12/17 10:35:02

  Modified:    src/xdocs codes.xml documentation.xml
               docs     codes.html documentation.html
  Added:       tests/input/joran asyncTest.xml
  Removed:     src/java/org/apache/log4j/test/xml asyncTest.xml
  Log:
  Declaration order of appenders matters. Documenting this fact.
  
  Revision  Changes    Path
  1.4       +82 -7     logging-log4j/src/xdocs/codes.xml
  
  Index: codes.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/xdocs/codes.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- codes.xml	30 Nov 2004 00:01:01 -0000	1.3
  +++ codes.xml	17 Dec 2004 18:35:02 -0000	1.4
  @@ -29,23 +29,28 @@
           <p class="red big">Good:</p>
   
           <pre>&lt;?xml version="1.0" encoding="UTF-8" ?>
  -<b>&lt;!DOCTYPE log4j:configuration></b>
  +<b>&lt;!DOCTYPE configuration></b>
   
  -&lt;log4j:configuration>
  +&lt;configuration xmlns='http://logging.apache.org/'>
     ...
  -&lt;/log4j:configuration>
  +&lt;/configuration>
           </pre>
   
  -        <p><code>JoranConfigurator</code> will no longer continue to
  +        <p>However, <code>JoranConfigurator</code> will continue to
           parse your old XML configuration files which previously
  -        required a reference to <code>log4j.dtd</code>. Thus, the 
  -        the following form will not work.
  +        required a reference to <code>log4j.dtd</code>. Thus, altough
  +        deprecated, the following form will continue to be parsed
  +        correctly.
           </p>
   
  -        <p class="red big">Bad:</p>
  +        <p class="red big">Deprecated:</p>
   
             <pre>&lt;?xml version="1.0" encoding="UTF-8" ?>
   <b>&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"></b>
  +
  +&lt;log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
  +  ...
  +&lt;/log4j:configuration>
           </pre>
        
   
  @@ -67,6 +72,76 @@
           <p>The <code>FileNamePattern</code> option for
           <code>TimeBasedRollingPolicy</code> is mandatory.
           </p>
  +      </explanation>
  +
  +    </message>
  +
  +  <message ref="appender_order">
  +      <title>Could not find an appender named [XYZ]. Did you define it below in the config file?</title>
  +
  +      <explanation>
  +        <p>Whereas the order of declatation of appenders did not
  +        matter in log4j 1.2, in log4j version 1.3 and later, any
  +        appender referenced at a given point must have been already
  +        declared above that point. In practice though, only
  +        configuration files declaring an <code>AsyncAppender</code>
  +        may be affected by this change and only if the appenders
  +        embeded in th <code>AsyncAppender</code> are declared below it
  +        instead of being declared above it.
  +        </p>
  +
  +        <p>For example, the following config file will no longer work.</p>
  +
  +        <p class="red big">Bad:</p>
  +
  +        <pre class="source">&lt;?xml version="1.0" encoding="UTF-8" ?>
  +&lt;!DOCTYPE log4j:configuration>
  +
  +&lt;log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
  +
  +  &lt;appender name="<b class="red">ASYNC</b>" class="org.apache.log4j.AsyncAppender">
  +    &lt;appender-ref ref="FILE" />
  +  &lt;/appender>
  +
  +   &lt;appender name="<b>FILE</b>" class="org.apache.log4j.FileAppender">
  +    &lt;param name="File" value="myapp.log"/>
  +    ...
  +  &lt;/appender>
  +
  +  &lt;root>
  +    &lt;level value ="debug" />
  +    &lt;appender-ref ref="ASYNC" />
  +  &lt;/root>
  +
  +&lt;/log4j:configuration>
  +        </pre>
  +
  +        <p>It should be changed to the following form.</p>
  +
  +        <p class="red big">Good:</p>
  +
  +        <pre class="source">&lt;?xml version="1.0" encoding="UTF-8" ?>
  +&lt;!DOCTYPE configuration>
  +
  +&lt;configuration xmlns='http://logging.apache.org/'>
  +
  +   &lt;appender name="<b class="red">FILE</b>" class="org.apache.log4j.FileAppender">
  +     &lt;param name="File" value="myapp.log"/>
  +      ...
  +   &lt;/appender>
  +
  +  &lt;appender name="<b>ASYNC</b>" class="org.apache.log4j.AsyncAppender">
  +    &lt;appender-ref ref="FILE" />
  +  &lt;/appender>
  +
  +  &lt;root>
  +    &lt;level value ="debug" />
  +    &lt;appender-ref ref="ASYNC" />
  +  &lt;/root>
  +&lt;/configuration>
  +        </pre>
  +
  +
         </explanation>
   
       </message>
  
  
  
  1.47      +5 -6      logging-log4j/src/xdocs/documentation.xml
  
  Index: documentation.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/xdocs/documentation.xml,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- documentation.xml	8 Dec 2004 17:36:15 -0000	1.46
  +++ documentation.xml	17 Dec 2004 18:35:02 -0000	1.47
  @@ -18,15 +18,14 @@
         
         <ul>
           <p>
  -          <a
  -           href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp"><img
  -           align="right" src="images/coverSmall.png"></img></a> <li><a
  -           href="manual.html"><b>short manual</b></a>, 
  -           </li>
  +          <a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp">
  +          <img align="right" src="images/coverSmall.png"></img>
  +          </a> 
  +          <li><a href="manual.html"><b>short log4j manual</b></a>, </li>
           </p>
           
           <p>
  -          <li><a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp"><b>complete manual</b></a> (commercial), 
  +          <li><a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp"><b>complete log4j manual</b></a> (commercial), 
             </li>
           </p>
           
  
  
  
  1.6       +89 -14    logging-log4j/docs/codes.html
  
  Index: codes.html
  ===================================================================
  RCS file: /home/cvs/logging-log4j/docs/codes.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- codes.html	12 Dec 2004 19:56:05 -0000	1.5
  +++ codes.html	17 Dec 2004 18:35:02 -0000	1.6
  @@ -53,13 +53,13 @@
         <h3>Ceki  G�lc� <br />
         November 2004, last updated on November 18th, 2004</h3>
       </center>
  -                                                                                                                                    
  +                                                                                                                                                                                         
               
     
  -                                  <hr/>
  +                                        <hr/>
   
     
  -                                                  <div class="big">
  +                                                        <div class="big">
           <a name="log4j_dtd">
            <b>Message:</b> <span class="msg_title">The 'log4j.dtd' is no longer used nor needed.</span>
           </a>
  @@ -76,23 +76,28 @@
           <p class="red big">Good:</p>
   
           <pre>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  -<b>&lt;!DOCTYPE log4j:configuration&gt;</b>
  +<b>&lt;!DOCTYPE configuration&gt;</b>
   
  -&lt;log4j:configuration&gt;
  +&lt;configuration xmlns='http://logging.apache.org/'&gt;
     ...
  -&lt;/log4j:configuration&gt;
  +&lt;/configuration&gt;
           </pre>
   
  -        <p><code>JoranConfigurator</code> will no longer continue to
  +        <p>However, <code>JoranConfigurator</code> will continue to
           parse your old XML configuration files which previously
  -        required a reference to <code>log4j.dtd</code>. Thus, the 
  -        the following form will not work.
  +        required a reference to <code>log4j.dtd</code>. Thus, altough
  +        deprecated, the following form will continue to be parsed
  +        correctly.
           </p>
   
  -        <p class="red big">Bad:</p>
  +        <p class="red big">Deprecated:</p>
   
             <pre>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
   <b>&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;</b>
  +
  +&lt;log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'&gt;
  +  ...
  +&lt;/log4j:configuration&gt;
           </pre>
        
   
  @@ -104,15 +109,85 @@
         </div>
                   <div class="big">
           <a name="tbr_fnp_not_set">
  -         <b>Message:</b> <span class="msg_title">The FileNamePattern option must be set before using TimeBasedRollingPolicy or FixedWindowRollingPolicy.</span>
  +         <b>Message:</b> <span class="msg_title">The FileNamePattern option must be set before using TimeBasedRollingPolicy.</span>
  +        </a>
  +      </div>
  +      <div class="msg_meaning">
  +        
  +        <p>The <code>FileNamePattern</code> option for
  +        <code>TimeBasedRollingPolicy</code> is mandatory.
  +        </p>
  +      
  +      </div>
  +                <div class="big">
  +        <a name="appender_order">
  +         <b>Message:</b> <span class="msg_title">Could not find an appender named [XYZ]. Did you define it below in the config file?</span>
           </a>
         </div>
         <div class="msg_meaning">
           
  -        <p>The <code>FileNamePattern</code> option for both
  -        <code>TimeBasedRollingPolicy</code> and
  -        <code>FixedWindowRollingPolicy</code> is mandatory.
  +        <p>Whereas the order of declatation of appenders did not
  +        matter in log4j 1.2, in log4j version 1.3 and later, any
  +        appender referenced at a given point must have been already
  +        declared above that point. In practice though, only
  +        configuration files declaring an <code>AsyncAppender</code>
  +        may be affected by this change and only if the appenders
  +        embeded in th <code>AsyncAppender</code> are declared below it
  +        instead of being declared above it.
           </p>
  +
  +        <p>For example, the following config file will no longer work.</p>
  +
  +        <p class="red big">Bad:</p>
  +
  +        <pre class="source">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  +&lt;!DOCTYPE log4j:configuration&gt;
  +
  +&lt;log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'&gt;
  +
  +  &lt;appender name="<b class="red">ASYNC</b>" class="org.apache.log4j.AsyncAppender"&gt;
  +    &lt;appender-ref ref="FILE" /&gt;
  +  &lt;/appender&gt;
  +
  +   &lt;appender name="<b>FILE</b>" class="org.apache.log4j.FileAppender"&gt;
  +    &lt;param name="File" value="myapp.log"/&gt;
  +    ...
  +  &lt;/appender&gt;
  +
  +  &lt;root&gt;
  +    &lt;level value ="debug" /&gt;
  +    &lt;appender-ref ref="ASYNC" /&gt;
  +  &lt;/root&gt;
  +
  +&lt;/log4j:configuration&gt;
  +        </pre>
  +
  +        <p>It should be changed to the following form.</p>
  +
  +        <p class="red big">Good:</p>
  +
  +        <pre class="source">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  +&lt;!DOCTYPE configuration&gt;
  +
  +&lt;configuration xmlns='http://logging.apache.org/'&gt;
  +
  +   &lt;appender name="<b class="red">FILE</b>" class="org.apache.log4j.FileAppender"&gt;
  +     &lt;param name="File" value="myapp.log"/&gt;
  +      ...
  +   &lt;/appender&gt;
  +
  +  &lt;appender name="<b>ASYNC</b>" class="org.apache.log4j.AsyncAppender"&gt;
  +    &lt;appender-ref ref="FILE" /&gt;
  +  &lt;/appender&gt;
  +
  +  &lt;root&gt;
  +    &lt;level value ="debug" /&gt;
  +    &lt;appender-ref ref="ASYNC" /&gt;
  +  &lt;/root&gt;
  +&lt;/configuration&gt;
  +        </pre>
  +
  +
         
         </div>
         
  
  
  
  1.34      +5 -3      logging-log4j/docs/documentation.html
  
  Index: documentation.html
  ===================================================================
  RCS file: /home/cvs/logging-log4j/docs/documentation.html,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- documentation.html	8 Dec 2004 17:36:15 -0000	1.33
  +++ documentation.html	17 Dec 2004 18:35:02 -0000	1.34
  @@ -57,12 +57,14 @@
         </p>
                                                   <ul>
           <p>
  -          <a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp"><img align="right" src="images/coverSmall.png" /></a> <li><a href="manual.html"><b>short manual</b></a>, 
  -           </li>
  +          <a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp">
  +          <img align="right" src="images/coverSmall.png" />
  +          </a> 
  +          <li><a href="manual.html"><b>short log4j manual</b></a>, </li>
           </p>
           
           <p>
  -          <li><a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp"><b>complete manual</b></a> (commercial), 
  +          <li><a href="https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp"><b>complete log4j manual</b></a> (commercial), 
             </li>
           </p>
           
  
  
  
  1.1                  logging-log4j/tests/input/joran/asyncTest.xml
  
  Index: asyncTest.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE log4j:configuration >
  
  <configuration xmlns='http://logging.apache.org/' debug="true">
  
    <appender name="TEMP" class="org.apache.log4j.FileAppender">
      <param name="File" value="output/temp"/>
      <param name="Append" value="false"/>
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%p - %m%n"/>
      </layout>
    </appender>
  
  
    <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
      <appender-ref ref="TEMP" />
    </appender>
  
    <root>
      <priority value ="debug" />
      <appender-ref ref="ASYNC" />
    </root>
  
  </configuration>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org