Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.logger
Class FileLogger

    java.lang.Object
      |
      +--org.apache.catalina.logger.LoggerBase
            |
            +--org.apache.catalina.logger.FileLogger

All Implemented Interfaces:
  Lifecycle, Logger

public final class FileLogger
extends org.apache.catalina.logger.LoggerBase
implements Lifecycle

Implementation of Logger that appends log messages to a file named {prefix}.{date}.{suffix} in a configured directory, with an optional preceding timestamp.

Version:
  $Revision: 1.3 $ $Date: 2001/08/27 19:10:25 $
Author:
  Craig R. McClanahan

Field Summary
`protected Container` | `container` The Container with which this Logger has been associated.
`protected static java.lang.String` | `info` The descriptive information about this implementation.
`protected LifecycleSupport` | `lifecycle` The lifecycle event support for this component.
`protected java.beans.PropertyChangeSupport` | `support` The property change support for this component.
`protected int` | `verbosity` The verbosity level for above which log messages may be filtered.

Fields inherited from interface org.apache.catalina.Lifecycle
`START_EVENT, STOP_EVENT`

Fields inherited from interface org.apache.catalina.Logger
`DEBUG, ERROR, FATAL, INFORMATION, WARNING`

Constructor Summary
`FileLogger()`

Method Summary
`void` | `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Add a property change listener to this component.
`Container` | `getContainer()` Return the Container with which this Logger has been associated.
`java.lang.String` | `getDirectory()` Return the directory in which we create log files.
`java.lang.String` | `getInfo()` Return descriptive information about this Logger implementation and the corresponding version number, in the format `<description>/<version>`.
`java.lang.String` | `getPrefix()` Return the log file prefix.
`java.lang.String` | `getSuffix()` Return the log file suffix.
`boolean` | `getTimestamp()` Return the timestamp flag.
`int` | `getVerbosity()` Return the verbosity level of this logger.
`void` | `log(java.lang.Exception exception, java.lang.String msg)` Writes the specified exception, and message, to a servlet log file.
`void` | `log(java.lang.String msg)` Writes the specified message to a servlet log file, usually an event log.
`void` | `log(java.lang.String message, int verbosity)` Writes the specified message to the servlet log file, usually an event log, if the logger is set to a verbosity level equal to or higher than the specified value for this message.
`void` | `log(java.lang.String msg, java.lang.Throwable throwable)` Writes an explanatory message and a stack trace for a given `Throwable` exception to the servlet log file.
`void` | `log(java.lang.String message, java.lang.Throwable throwable, int verbosity)` Writes the specified message and exception to the servlet log file, usually an event log, if the logger is set to a verbosity level equal to or higher than the specified value for this message.
`void` | `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Remove a property change listener from this component.
`void` | `setContainer(Container container)` Set the Container with which this Logger has been associated.
`void` | `setDirectory(java.lang.String directory)` Set the directory in which we create log files.
`void` | `setPrefix(java.lang.String prefix)` Set the log file prefix.
`void` | `setSuffix(java.lang.String suffix)` Set the log file suffix.
`void` | `setTimestamp(boolean timestamp)` Set the timestamp flag.
`void` | `setVerbosity(int verbosity)` Set the verbosity level of this logger.
`void` | `setVerbosityLevel(java.lang.String verbosity)` Set the verbosity level of this logger.
`void` | `start()` Prepare for the beginning of active use of the public methods of this component.
`void` | `stop()` Gracefully terminate the active use of the public methods of this component.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### info

    protected static final java.lang.String info

  The descriptive information about this implementation.

### lifecycle

    protected LifecycleSupport lifecycle

  The lifecycle event support for this component.

### container

    protected Container container

  The Container with which this Logger has been associated.

### support

    protected java.beans.PropertyChangeSupport support

  The property change support for this component.

### verbosity

    protected int verbosity

  The verbosity level for above which log messages may be filtered.

Constructor Detail

### FileLogger

    public FileLogger()

Method Detail

### getDirectory

    public java.lang.String getDirectory()

  Return the directory in which we create log files.

### setDirectory

    public void setDirectory(java.lang.String directory)

  Set the directory in which we create log files.
  Parameters:
    `directory` - The new log file directory

### getPrefix

    public java.lang.String getPrefix()

  Return the log file prefix.

### setPrefix

    public void setPrefix(java.lang.String prefix)

  Set the log file prefix.
  Parameters:
    `prefix` - The new log file prefix

### getSuffix

    public java.lang.String getSuffix()

  Return the log file suffix.

### setSuffix

    public void setSuffix(java.lang.String suffix)

  Set the log file suffix.
  Parameters:
    `suffix` - The new log file suffix

### getTimestamp

    public boolean getTimestamp()

  Return the timestamp flag.

### setTimestamp

    public void setTimestamp(boolean timestamp)

  Set the timestamp flag.
  Parameters:
    `timestamp` - The new timestamp flag

### log

    public void log(java.lang.String msg)

  Writes the specified message to a servlet log file, usually an event log. The name and type of the servlet log is specific to the servlet container.
  Overrides:
    `log` in class `org.apache.catalina.logger.LoggerBase`
  Parameters:
    `msg` - A `String` specifying the message to be written to the log file

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

  Add a lifecycle event listener to this component.
  Specified by:
    `addLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

  Remove a lifecycle event listener from this component.
  Specified by:
    `removeLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### start

    public void start()
               throws LifecycleException

  Prepare for the beginning of active use of the public methods of this component. This method should be called after `configure()`, and before any of the public methods of the component are utilized.
  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `java.lang.IllegalStateException` - if this component has already been started
    `LifecycleException` - if this component detects a fatal error that prevents this component from being used

### stop

    public void stop()
              throws LifecycleException

  Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `java.lang.IllegalStateException` - if this component has not been started
    `LifecycleException` - if this component detects a fatal error that needs to be reported

### getContainer

    public Container getContainer()

  Return the Container with which this Logger has been associated.
  Specified by:
    `getContainer` in interface `Logger`

### setContainer

    public void setContainer(Container container)

  Set the Container with which this Logger has been associated.
  Specified by:
    `setContainer` in interface `Logger`
  Parameters:
    `container` - The associated Container

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this Logger implementation and the corresponding version number, in the format `<description>/<version>`.
  Specified by:
    `getInfo` in interface `Logger`

### getVerbosity

    public int getVerbosity()

  Return the verbosity level of this logger. Messages logged with a higher verbosity than this level will be silently ignored.
  Specified by:
    `getVerbosity` in interface `Logger`

### setVerbosity

    public void setVerbosity(int verbosity)

  Set the verbosity level of this logger. Messages logged with a higher verbosity than this level will be silently ignored.
  Specified by:
    `setVerbosity` in interface `Logger`
  Parameters:
    `verbosity` - The new verbosity level

### setVerbosityLevel

    public void setVerbosityLevel(java.lang.String verbosity)

  Set the verbosity level of this logger. Messages logged with a higher verbosity than this level will be silently ignored.
  Parameters:
    `verbosityLevel` - The new verbosity level, as a string

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Add a property change listener to this component.
  Specified by:
    `addPropertyChangeListener` in interface `Logger`
  Parameters:
    `listener` - The listener to add

### log

    public void log(java.lang.Exception exception,
                    java.lang.String msg)

  Writes the specified exception, and message, to a servlet log file. The implementation of this method should call `log(msg, exception)` instead. This method is deprecated in the ServletContext interface, but not deprecated here to avoid many useless compiler warnings. This message will be logged unconditionally.
  Specified by:
    `log` in interface `Logger`
  Parameters:
    `exception` - An `Exception` to be reported
    `msg` - The associated message string

### log

    public void log(java.lang.String msg,
                    java.lang.Throwable throwable)

  Writes an explanatory message and a stack trace for a given `Throwable` exception to the servlet log file. The name and type of the servlet log file is specific to the servlet container, usually an event log. This message will be logged unconditionally.
  Specified by:
    `log` in interface `Logger`
  Parameters:
    `msg` - A `String` that describes the error or exception
    `throwable` - The `Throwable` error or exception

### log

    public void log(java.lang.String message,
                    int verbosity)

  Writes the specified message to the servlet log file, usually an event log, if the logger is set to a verbosity level equal to or higher than the specified value for this message.
  Specified by:
    `log` in interface `Logger`
  Parameters:
    `message` - A `String` specifying the message to be written to the log file
    `verbosity` - Verbosity level of this message

### log

    public void log(java.lang.String message,
                    java.lang.Throwable throwable,
                    int verbosity)

  Writes the specified message and exception to the servlet log file, usually an event log, if the logger is set to a verbosity level equal to or higher than the specified value for this message.
  Specified by:
    `log` in interface `Logger`
  Parameters:
    `message` - A `String` that describes the error or exception
    `throwable` - The `Throwable` error or exception
    `verbosity` - Verbosity level of this message

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Remove a property change listener from this component.
  Specified by:
    `removePropertyChangeListener` in interface `Logger`
  Parameters:
    `listener` - The listener to remove

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.