You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2004/06/25 05:30:31 UTC
cvs commit: jakarta-tomcat-catalina/webapps/docs/config logger.xml
billbarker 2004/06/24 20:30:31
Modified: webapps/docs/config logger.xml
Log:
Replacing documentation on the extinct Catalina Logger with a start on logging.
This doesn't belong here, but I don't feel like finding a place for it right now. This is mostly so that there is something for the early adopters have something to follow, and maybe stop whining on the dev list ;-).
Revision Changes Path
1.4 +83 -116 jakarta-tomcat-catalina/webapps/docs/config/logger.xml
Index: logger.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/logger.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- logger.xml 15 Jan 2003 03:40:44 -0000 1.3
+++ logger.xml 25 Jun 2004 03:30:31 -0000 1.4
@@ -16,12 +16,10 @@
<section name="Introduction">
- <p>A <strong>Logger</strong> element represents a destination for
- logging, debugging, and error messages (including stack tracebacks)
- for a Catalina container (<a href="engine.html">Engine</a>,
- <a href="host.html">Host</a>, or <a href="context.html">Context</a>).
- In addition, Loggers associated with an Engine or a Host are automatically
- inherited by lower-level containers, unless explicitly overridden.</p>
+ <p>Tomcat uses the
+ <a href="http://jakarta.apache.org/commons/logging/">Commons Logging</a>
+ package to implement all logging. This includes the logging defined
+ by <code>ServletContext.log</code>.</p>
<p>If you are interested in producing access logs like a web server does
(for example, to run hit count analysis software), you will want to configure
@@ -30,9 +28,6 @@
<a href="host.html#Access Logs">Host</a>, or
<a href="context.html#Access Logs">Context</a>.</p>
- <p>For a more in-depth description of the class loader hierarchy
- that is implemented by Catalina, see <strong>FIXME - Reference</strong>.</p>
-
<blockquote><em>
<p>The description below uses the variable name $CATALINA_HOME
to refer to the directory into which you have installed Tomcat 5,
@@ -46,121 +41,93 @@
</section>
-<section name="Attributes">
-
- <subsection name="Common Attributes">
-
- <p>All implementations of <strong>Logger</strong>
- support the following attributes:</p>
-
- <attributes>
-
- <attribute name="className" required="true">
- <p>Java class name of the implementation to use. This class must
- implement the <code>org.apache.catalina.Logger</code> interface.</p>
- </attribute>
-
- <attribute name="verbosity" required="false">
- <p>The verbosity level for this logger. Messages with a higher
- verbosity level than the specified value will be silently ignored.
- Available levels are 0 (fatal messages only), 1 (errors), 2
- (warnings), 3 (information), and 4 (debug). If not specified, the
- default value will be 1 (error).</p>
-
- <p><strong>NOTE</strong> - Only messages logged with an explicit
- verbosity level are compared to this value. Messages logged with
- no explicit verbosity level are logged unconditionally.</p>
- </attribute>
-
- </attributes>
-
- </subsection>
-
-
- <subsection name="Standard Implementation">
-
- <p>Unlike most Catalina components, there are several standard
- <strong>Logger</strong> implementations available. As a result,
- the <code>className</code> attribute MUST be used to select the
- implementation you wish to use.</p>
-
- <h3>File Logger (org.apache.catalina.logger.FileLogger)</h3>
-
- <p>The <strong>File Logger</strong> records all logged messages to
- disk file(s) in a specified directory. The actual filenames of the
- log files are created from a configured prefix, the current date in
- YYYY-MM-DD format, and a configured suffix. On the first logged
- message after midnight each day, the current log file will be closed
- and a new file opened for the new date, without having to shut down
- Catalina in order to perform this switch.</p>
-
- <p>The File Logger supports the following attributes:</p>
-
- <attributes>
-
- <attribute name="directory" required="false">
- <p>Absolute or relative pathname of a directory in which log files
- created by this logger will be placed. If a relative path is
- specified, it is interpreted as relative to $CATALINA_HOME. If
- no directory attribute is specified, the default value is "logs"
- (relative to $CATALINA_HOME).</p>
- </attribute>
-
- <attribute name="prefix" required="false">
- <p>The prefix added to the start of each log file's name. If not
- specified, the default value is "catalina.". To specify no prefix,
- use a zero-length string.</p>
- </attribute>
-
- <attribute name="suffix" required="false">
- <p>The suffix added to the end of each log file's name. If not
- specified, the default value is ".log". To specify no suffix,
- use a zero-length string.</p>
- </attribute>
-
- <attribute name="timestamp" required="false">
- <p>Set to <code>true</code> to cause all logged messages to be
- date and time stamped. Set to <code>false</code> (the default)
- to skip date/time stamping.</p>
- </attribute>
-
- </attributes>
-
- <h3>Standard Error Logger (org.apache.catalina.logger.SystemErrLogger)</h3>
-
- <p>The <strong>Standard Error Logger</strong> records all logged messages
- to whatever stream the standard error output of Catalina is pointed at.
- The default Catalina startup script points this at file
- <code>logs/catalina.out</code> relative to $CATALINA_HOME. This
- logger supports no additional attributes.</p>
-
- <h3>Standard Output Logger (org.apache.catalina.logger.SystemOutLogger)</h3>
-
- <p>The <strong>Standard Output Logger</strong> records all logged messages
- to whatever stream the standard output of Catalina is pointed at.
- The default Catalina startup script points this at file
- <code>logs/catalina.out</code> relative to $CATALINA_HOME. This
- logger supports no additional attributes.</p>
-
- </subsection>
-
-
+<section name="Using Log4j">
+ <p>One of the options for logging is to use the
+ <a href="http://logging.apache.org/log4j/">Log4j</a> package to implement
+ the logging for Tomcat. The simplest way to do this is to copy the
+ <code>log4j-x.x.x.jar</code> and the <code>commons-logging.jar</code>
+ to <em>$CATALINA_HOME/common/lib</em>. The <em>log4j.xml</em> file
+ can then be placed in <em>$CATALINA_HOME/common/classes</em>. An example
+ configuration is:</p>
+ <source>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "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 (%F:%L) - %m%n"/>
+ </layout>
+ </appender>
+ <appender name="catalina"
+ class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File"
+ value="${catalina.home}/logs/catalina_log.txt" />
+ <param name="DatePattern" value="'.'yyy-MM-dd" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%-5p %d - %m%n"/>
+ </layout>
+ </appender>
+ <appender name="localhost"
+ class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File"
+ value="${catalina.home}/logs/localhost_log.txt" />
+ <param name="DatePattern" value="'.'yyy-MM-dd" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%-5p %d - %m%n"/>
+ </layout>
+ </appender>
+ <appender name="localhost.admin"
+ class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File"
+ value="${catalina.home}/logs/localhost_admin_log.txt" />
+ <param name="DatePattern" value="'.'yyy-MM-dd" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%-5p %d - %m%n"/>
+ </layout>
+ </appender>
+
+ <category
+ name="org.apache.catalina.core.ContainerBase.[Catalina]"
+ additivity="false">
+ <priority value="info" />
+ <appender-ref ref="catalina" />
+ </category>
+ <category
+ name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]"
+ additivity="false">
+ <priority value="info" />
+ <appender-ref ref="localhost" />
+ </category>
+ <category
+ name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin]"
+ additivity="false">
+ <priority value="info" />
+ <appender-ref ref="localhost.admin" />
+ </category>
+
+ <root>
+ <priority value ="info" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</log4j:configuration>
+ </source>
</section>
-<section name="Nested Components">
+<section name="Using JDK1.4 logging">
- <p>No components may be nested inside a <strong>Logger</strong> element.</p>
+ <p><strong>TO DO</strong></p>
</section>
-<section name="Special Features">
-
- <p>No special features are associated with a <strong>Logger</strong>
- element.</p>
-
-</section>
</body>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org