Links Docs Home Config Ref. Home Top Level Elements Server Service Connectors General Intro HTTP AJP Containers Context Engine Host Nested Components Default Context Global Resources Loader Logger Manager Realm Resources Valve |
# Server Configuration Reference ## The Logger Component | print-friendly version
Introduction
Please note that Loggers are deprecated in Tomcat 5.0 and removed from Tomcat 5.5. Tomcat 5.5 uses Commons-Logging instead. A Logger element represents a destination for logging, debugging, and error messages (including stack tracebacks) for a Catalina container (Engine, Host, or Context). In addition, Loggers associated with an Engine or a Host are automatically inherited by lower-level containers, unless explicitly overridden. 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 an Access Log Valve component on your Engine, Host, or Context. For a more in-depth description of the class loader hierarchy that is implemented by Catalina, see the ClassLoader HOW-TO The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat 5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.
Attributes
> Common Attributes
> > All implementations of Logger support the following attributes:
> > Attribute | Description
> > --- | ---
> > `className` | Java class name of the implementation to use. This class must implement the `org.apache.catalina.Logger` interface.
> > `verbosity` | 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). NOTE - Only messages logged with an explicit verbosity level are compared to this value. Messages logged with no explicit verbosity level are logged unconditionally.
> Standard Implementation
> > Unlike most Catalina components, there are several standard Logger implementations available. As a result, the `className` attribute MUST be used to select the implementation you wish to use. ### File Logger (org.apache.catalina.logger.FileLogger) The File Logger 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. The File Logger supports the following attributes:
> > Attribute | Description
> > --- | ---
> > `directory` | 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).
> > `prefix` | 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.
> > `suffix` | 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.
> > `timestamp` | Set to `true` to cause all logged messages to be date and time stamped. Set to `false` (the default) to skip date/time stamping.
> ### Standard Error Logger (org.apache.catalina.logger.SystemErrLogger) The Standard Error Logger 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 `logs/catalina.out` relative to $CATALINA_HOME. This logger supports no additional attributes. ### Standard Output Logger (org.apache.catalina.logger.SystemOutLogger) The Standard Output Logger records all logged messages to whatever stream the standard output of Catalina is pointed at. The default Catalina startup script points this at file `logs/catalina.out` relative to $CATALINA_HOME. This logger supports no additional attributes.
Nested Components
No components may be nested inside a Logger element.
Special Features
No special features are associated with a Logger element.
Copyright © 1999-2003, Apache Software Foundation