logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1386707 - in /logging/log4j/log4j2/trunk/src/site: site.xml xdoc/manual/appenders.xml xdoc/manual/migration.xml
Date Mon, 17 Sep 2012 16:36:47 GMT
Author: rgoers
Date: Mon Sep 17 16:36:47 2012
New Revision: 1386707

URL: http://svn.apache.org/viewvc?rev=1386707&view=rev
Log:
Fix errors in documentation

Modified:
    logging/log4j/log4j2/trunk/src/site/site.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/migration.xml

Modified: logging/log4j/log4j2/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/site.xml?rev=1386707&r1=1386706&r2=1386707&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/site.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/site.xml Mon Sep 17 16:36:47 2012
@@ -78,8 +78,9 @@
         <item name="SystemProperties" href="/manual/lookups.html#SystemPropertiesLookup"/>
       </item>
       <item name="Appenders" href="/manual/appenders.html" collapse="true">
-        <item name="Console" href="/manual/appenders.html@ConsoleAppender"/>
-        <item name="Failover" href="/manual/appenders.html@FailoverAppender"/>
+        <item name="Asynch" href="/manual/appenders.html#AsynchAppender"/>
+        <item name="Console" href="/manual/appenders.html#ConsoleAppender"/>
+        <item name="Failover" href="/manual/appenders.html#FailoverAppender"/>
         <item name="File" href="/manual/appenders.html#FileAppender"/>
         <item name="Flume" href="/manual/appenders.html#FlumeAvroAppender"/>
         <item name="JMSQueue" href="/manual/appenders.html#JMSQueueAppender"/>

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml?rev=1386707&r1=1386706&r2=1386707&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/appenders.xml Mon Sep 17 16:36:47 2012
@@ -49,7 +49,8 @@
         <subsection name="AsynchAppender">
           <p>The AsynchAppender accepts references to other Appenders and causes LogEvents
to be written to them
             on a separate Thread. Note that exceptions while writing to those Appenders will
be hidden from
-            the application. </p>
+            the application. The AsynchAppender should be configured after the appenders
it references to allow it
+            to shut down properly.</p>
           <table border="1" width="100%">
             <tr>
               <th>Parameter Name</th>
@@ -822,7 +823,8 @@
           <p>
             The RewriteAppender allows the LogEvent to manipulated before it is processed
by another Appender. This
             can be used to mask sensitive information such as passwords or to inject information
into each event.
-            The RewriteAppender must be configured with a <a href="RewritePolicy">RewritePolicy</a>.
+            The RewriteAppender must be configured with a <a href="RewritePolicy">RewritePolicy</a>.
The
+            RewriteAppender should be configured after any Appenders it references to allow
it to shut down properly.
           </p>
           <table border="1" width="100%">
             <tr>
@@ -1128,7 +1130,8 @@
            <p>
              The RoutingAppender evaluates LogEvents and then routes them to a subordinate
Appender. The target
              Appender may be an appender previously configured and may be referenced by its
name or the
-             Appender can be dynamically created as needed.
+             Appender can be dynamically created as needed. The RoutingAppender should be
configured after any
+             Appenders it references to allow it to shut down properly.
           </p>
           <table border="1" width="100%">
             <tr>

Modified: logging/log4j/log4j2/trunk/src/site/xdoc/manual/migration.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/src/site/xdoc/manual/migration.xml?rev=1386707&r1=1386706&r2=1386707&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/src/site/xdoc/manual/migration.xml (original)
+++ logging/log4j/log4j2/trunk/src/site/xdoc/manual/migration.xml Mon Sep 17 16:36:47 2012
@@ -33,18 +33,21 @@
               <ol>
                 <li>They must not access methods and classes internal to the Log4j
1.x implementation such
                 as Appenders, LoggerRepository or Logger's callAppenders method.</li>
-                <li>They must not be programmatically configuring Log4j.</li>
+                <li>They must not programmatically configure Log4j.</li>
                 <li>They must not be configuring by calling DomConfigurator or the
PropertiesConfigurator.</li>
               </ol>
             </p>
           </subsection>
           <subsection name="Converting to the Log4j 2 API">
             <p>For the most part, converting from the Log4j 1.x API to Log4j 2.0 should
be fairly simple. Many
-              of the log statements will require no modification. However, the following
changes must be
+              of the log statements will require no modification. However, where necessary
the following changes must be
               made.
               <ol>
                 <li>Calls to Logger.getLogger must be modified to LogManager.getLogger.</li>
-                <li>Calls to Logger.getRootLogger must be replaced woth LogManager.getLogger("").</li>
+                <li>Calls to Logger.getRootLogger or LogManager.getRootLogger must
be replaced woth
+                  LogManager.getLogger("").</li>
+                <li>Calls to LogManager.getLogger that accept a LoggerFactory must
remove the LoggerFactory and
+                  use one of Log4j 2's other extension mechanisms.</li>
                 <li>Calls to logger.setLevel or similar methods are not supported in
the API. Applications
                   should remove these. Equivalent functionality is provided in the Log4j
2 implementation
                   classes but may leave the application susceptible to changes in Log4j 2
internals.</li>
@@ -63,30 +66,27 @@
               counterparts in Log4j 2.
             </p>
 
-            <h4>Sample 1</h4>
+            <h4>Sample 1 - Simple configuration using a Console Appender</h4>
             <p>Log4j 1.x XML configuration</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
 <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
-
-	<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-           <layout class="org.apache.log4j.PatternLayout">
-             <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
-           </layout>
-	</appender>
-
-	<category name="org.apache.log4j.xml">
-	  <priority value="info" />
-	</category>
-
-	<root>
-	   <priority value ="debug" />
-   	   <appender-ref ref="STDOUT" />
-	</root>
+  <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+    </layout>
+  </appender>
+  <category name="org.apache.log4j.xml">
+    <priority value="info" />
+  </category>
+  <root>
+    <priority value ="debug" />
+    <appender-ref ref="STDOUT" />
+  </root>
 </log4j:configuration>]]></source>
             <p>Log4j 2 XML configuration</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<configuration status="OFF">
+<configuration>
   <appenders>
     <Console name="STDOUT" target="SYSTEM_OUT">
       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
@@ -100,41 +100,36 @@
   </loggers>
 </configuration>]]></source>
 
-            <h4>Sample 2</h4>
+            <h4>Sample 2 - Simple configuration using a File Appender</h4>
             <p>Log4j 1.x XML configuration</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-	<appender name="A1" class="org.apache.log4j.FileAppender">
-            <param name="File"   value="A1.log" />
-            <param name="Append" value="false" />
-            <layout class="org.apache.log4j.PatternLayout">
-		<param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
-            </layout>
-	</appender>
-
-	<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-		<layout class="org.apache.log4j.PatternLayout">
-                   <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) -
%m%n"/>
-		</layout>
-	</appender>
-
-	<category name="org.apache.log4j.xml">
-	  <priority value="debug" />
-  	  <appender-ref ref="A1" />
-	</category>
-
-	<root>
-	   <priority value ="debug" />
-   	   <appender-ref ref="STDOUT" />
-	</root>
-
+  <appender name="A1" class="org.apache.log4j.FileAppender">
+    <param name="File"   value="A1.log" />
+    <param name="Append" value="false" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
+    </layout>
+  </appender>
+  <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+    </layout>
+  </appender>
+  <category name="org.apache.log4j.xml">
+    <priority value="debug" />
+    <appender-ref ref="A1" />
+  </category>
+  <root>
+    <priority value ="debug" />
+    <appender-ref ref="STDOUT" />
+  </root>
 </log4j:configuration>]]></source>
 
            <p>Log4j 2 XML configuration</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<configuration status="OFF">
+<configuration>
   <appenders>
     <File name="A1" fileName="A1.log" append="false">
       <PatternLayout pattern="%t %-5p %c{2} - %m%n"/>
@@ -142,7 +137,7 @@
     <Console name="STDOUT" target="SYSTEM_OUT">
       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
     </Console>
-  </appenders
+  </appenders>
   <loggers>
     <logger name="org.apache.log4j.xml" level="debug">
       <appender-ref ref="A1"/>
@@ -153,38 +148,38 @@
   </loggers>
 </configuration>]]></source>
 
-            <h4>Sample 3</h4>
+            <h4>Sample 3 - SocketAppender</h4>
             <p>Log4j 1.x XML configuration. This example from Log4j 1.x is misleading.
The SocketAppender does not
               actually use a Layout. Configuring one will have no effect.</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
- <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-	<appender name="A1" class="org.apache.log4j.net.SocketAppender">
-		<param name="RemoteHost" value="localhost"/>
-		<param name="Port" value="5000"/>
-		<param name="LocationInfo" value="true"/>
-		<layout class="org.apache.log4j.PatternLayout">
-  		   <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
-		</layout>
-	</appender>
-	<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
-		<layout class="org.apache.log4j.PatternLayout">
-  		     <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
-		</layout>
-	</appender>
-	<category name="org.apache.log4j.xml">
-		<priority value="debug"/>
-		<appender-ref ref="A1"/>
-	</category>
-	<root>
-		<priority value="debug"/>
-		<appender-ref ref="STDOUT"/>
-	</root>
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+  <appender name="A1" class="org.apache.log4j.net.SocketAppender">
+    <param name="RemoteHost" value="localhost"/>
+    <param name="Port" value="5000"/>
+    <param name="LocationInfo" value="true"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
+    </layout>
+  </appender>
+  <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+    </layout>
+  </appender>
+  <category name="org.apache.log4j.xml">
+    <priority value="debug"/>
+    <appender-ref ref="A1"/>
+  </category>
+  <root>
+    <priority value="debug"/>
+    <appender-ref ref="STDOUT"/>
+  </root>
 </log4j:configuration>]]></source>
 
            <p>Log4j 2 XML configuration</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<configuration status="OFF">
+<configuration>
   <appenders>
     <Socket name="A1" host="localHost" port="5000">
       <SerializedLayout/>
@@ -192,7 +187,7 @@
     <Console name="STDOUT" target="SYSTEM_OUT">
       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
     </Console>
-  </appenders
+  </appenders>
   <loggers>
     <logger name="org.apache.log4j.xml" level="debug">
       <appender-ref ref="A1"/>
@@ -203,41 +198,37 @@
   </loggers>
 </configuration>]]></source>
 
-            <h4>Sample 4</h4>
+            <h4>Sample 4 - AsynchAppender</h4>
             <p>Log4j 1.x XML configuration using the AsynchAppender.</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
-                     configDebug="true">
-
-	<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
-	        <appender-ref ref="TEMP"/>
-	</appender>
-
-	<appender name="TEMP" class="org.apache.log4j.FileAppender">
-		<param name="File" value="temp"/>
-		<layout class="org.apache.log4j.PatternLayout">
-  		     <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
-		</layout>
-	</appender>
-
-	<root>
-		<priority value="debug"/>
-		<appender-ref ref="ASYNC"/>
-	</root>
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" configDebug="true">
+  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+    <appender-ref ref="TEMP"/>
+  </appender>
+  <appender name="TEMP" class="org.apache.log4j.FileAppender">
+    <param name="File" value="temp"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+    </layout>
+  </appender>
+  <root>
+    <priority value="debug"/>
+    <appender-ref ref="ASYNC"/>
+  </root>
 </log4j:configuration>]]></source>
 
            <p>Log4j 2 XML configuration. </p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<configuration status="OFF">
+<configuration status="debug">
   <appenders>
-    <File name="TEMP" fileName="temp" append="false">
+    <File name="TEMP" fileName="temp">
       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
     </File>
     <Asynch name="ASYNC">
       <appender-ref ref="TEMP"/>
     </Asynch>
-  </appenders
+  </appenders>
   <loggers>
     <root level="debug">
       <appender-ref ref="ASYNC"/>
@@ -246,52 +237,48 @@
 </configuration>]]></source>
 
 
-            <h4>Sample 5</h4>
+            <h4>Sample 5 - AsynchAppender with Console and File</h4>
             <p>Log4j 1.x XML configuration using the AsynchAppender.</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
 <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" configDebug="true">
-
-	<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
-	        <appender-ref ref="TEMP"/>
-		<appender-ref ref="CONSOLE"/>
-	</appender>
-
-	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-		<layout class="org.apache.log4j.PatternLayout">
-  		     <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
-		</layout>
-	</appender>
-
-	<appender name="TEMP" class="org.apache.log4j.FileAppender">
-		<param name="File" value="temp"/>
-		<layout class="org.apache.log4j.PatternLayout">
-  		     <param name="ConversionPattern"
-                            value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
-		</layout>
-	</appender>
-
-	<root>
-		<priority value="debug"/>
-		<appender-ref ref="ASYNC"/>
-	</root>
+  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+    <appender-ref ref="TEMP"/>
+    <appender-ref ref="CONSOLE"/>
+  </appender>
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+    </layout>
+  </appender>
+  <appender name="TEMP" class="org.apache.log4j.FileAppender">
+    <param name="File" value="temp"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
+    </layout>
+  </appender>
+  <root>
+    <priority value="debug"/>
+    <appender-ref ref="ASYNC"/>
+  </root>
 </log4j:configuration>]]></source>
 
-            <p>Log4j 2 XML configuration. </p>
+            <p>Log4j 2 XML configuration. Note that the Asynch Appender should be configured
after the appenders it
+              references. This will allow it to shutdown properly.</p>
             <source><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
 <configuration status="debug">
   <appenders>
     <Console name="CONSOLE" target="SYSTEM_OUT">
       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
     </Console>
-    <File name="TEMP" fileName="temp" append="false">
+    <File name="TEMP" fileName="temp">
       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
     </File>
     <Asynch name="ASYNC">
       <appender-ref ref="TEMP"/>
       <appender-ref ref="CONSOLE"/>
     </Asynch>
-  </appenders
+  </appenders>
   <loggers>
     <root level="debug">
       <appender-ref ref="ASYNC"/>



Mime
View raw message