You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2008/06/10 21:42:56 UTC
svn commit: r666295 - /velocity/engine/trunk/xdocs/docs/developer-guide.xml
Author: nbubna
Date: Tue Jun 10 12:42:56 2008
New Revision: 666295
URL: http://svn.apache.org/viewvc?rev=666295&view=rev
Log:
VELTOOLS-559 replace/remove Log4j Category references with Logger
Modified:
velocity/engine/trunk/xdocs/docs/developer-guide.xml
Modified: velocity/engine/trunk/xdocs/docs/developer-guide.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/xdocs/docs/developer-guide.xml?rev=666295&r1=666294&r2=666295&view=diff
==============================================================================
--- velocity/engine/trunk/xdocs/docs/developer-guide.xml (original)
+++ velocity/engine/trunk/xdocs/docs/developer-guide.xml Tue Jun 10 12:42:56 2008
@@ -91,7 +91,7 @@
<a href="#configuring_logging">Configuring Logging</a>
<ul>
<li>
- <a href="#usinglog4jwithexistingcategory">Using Log4j With Existing Category</a>
+ <a href="#usinglog4jwithexistinglogger">Using Log4j With Existing Logger</a>
</li>
<li>
<a href="#simpleexampleofacustomlogger">Simple Example of a Custom Logger</a>
@@ -1912,28 +1912,17 @@
</li>
<li>
-<b>Existing Log4j Logger/Category</b><br/>
+<b>Existing Log4j Logger</b><br/>
Starting with version 1.3, Velocity will log its output to an existing
-Log4j Category setup elsewhere in the application. With version 1.5, we have
-switched to using the Logger class, as the Category class is now deprecated
-in Log4j. To use this feature you must
+Log4j Logger setup elsewhere in the application. To use this feature you must
<ol>
<li>
Make sure that the Log4j jar is in your classpath. (You would do this
anyway since you are using Log4j in the application using Velocity.)
</li>
- <li>
- a) If your environment uses the Logger class,
- configure Velocity to use the <code>Log4JLogChute</code> class.
- b) If your system still uses the deprecated Category, you can
- configure Velocity to use the very deprecated
- <code>SimpleLog4JLogSystem</code> class.
- </li>
- <li>
- a) If using a Logger, specify the name of the existing Logger to use via the
+ <li>Configure Velocity to use the <code>Log4JLogChute</code> class by
+ specifying the name of the existing Logger to use via the
'runtime.log.logsystem.log4j.logger' property.
- b) If using a Category, specify the name of the existing Category to use via the
- 'runtime.log.logsystem.log4j.category' property.
</li>
</ol>
@@ -1983,23 +1972,23 @@
</ul>
-<a name="usinglog4jwithexistingcategory"><strong>Using Log4j With Existing Category</strong></a>
+<a name="usinglog4jwithexistinglogger"><strong>Using Log4j With Existing Logger</strong></a>
<p>
Here is an example of how to configure Velocity to log to an existing Log4j
-Category.
+Logger.
</p>
<source><![CDATA[
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;
-public class Log4jCategoryExample
+public class Log4jLoggerExample
{
- public static String CATEGORY_NAME = "velexample";
+ public static String LOGGER_NAME = "velexample";
public static void main( String args[] )
throws Exception
@@ -2010,9 +1999,9 @@
BasicConfigurator.configure();
- Category log = Category.getInstance( CATEGORY_NAME );
+ Logger log = Logger.getLogger( LOGGER_NAME );
- log.info("Log4jCategoryExample: ready to start velocity");
+ log.info("Log4jLoggerExample: ready to start velocity");
/*
* now create a new VelocityEngine instance, and
@@ -2022,10 +2011,10 @@
VelocityEngine ve = new VelocityEngine();
ve.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
- "org.apache.velocity.runtime.log.SimpleLog4JLogSystem" );
+ "org.apache.velocity.runtime.log.Log4JLogChute" );
- ve.setProperty("runtime.log.logsystem.log4j.category",
- CATEGORY_NAME);
+ ve.setProperty("runtime.log.logsystem.log4j.logger",
+ LOGGER_NAME);
ve.init();