LogHandler (Tomcat API Documentation)
Keywords: org.apache.tomcat.util.log.LogHandler class

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

## org.apache.tomcat.util.log
Class LogHandler

    java.lang.Object
      org.apache.tomcat.util.log.LogHandler

Direct Known Subclasses:
  CommonLogHandler

public class LogHandler
extends java.lang.Object

Log destination ( or channel ). This is the base class that will be extended by log handlers - tomcat uses util.qlog.QueueLogger, in future we'll use log4j or java.util.logger adapters. The base class writes to a (default) writer, and it can be used for very simple logging.

Author:
  Anil Vijendran (akv@eng.sun.com), Alex Chaffee (alex@jguru.com), Ignacio J. Ortega (nacho@siapi.es), Costin Manolache

Field Summary
`protected static java.io.PrintWriter` | `defaultSink`
`protected int` | `level`
`protected java.io.PrintWriter` | `sink`

Constructor Summary
`LogHandler()`

Method Summary
`void` | `close()` Close the log.
`void` | `flush()` Flush the log.
`int` | `getLevel()` Get the current verbosity level.
`void` | `log(java.lang.String prefix, java.lang.String msg, java.lang.Throwable t, int verbosityLevel)` Prints log message and stack trace.
`static void` | `setDefaultSink(java.io.Writer w)` Set the default output stream that is used by all logging channels.
`void` | `setLevel(int level)` Set the verbosity level for this logger.

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

Field Detail

### sink

    protected java.io.PrintWriter sink

### level

    protected int level

### defaultSink

    protected static java.io.PrintWriter defaultSink

Constructor Detail

### LogHandler

    public LogHandler()

Method Detail

### log

    public void log(java.lang.String prefix,
                    java.lang.String msg,
                    java.lang.Throwable t,
                    int verbosityLevel)

  Prints log message and stack trace. This method should be overriden by real logger implementations

  Parameters:
    `prefix` - optional prefix.
    `t` - the exception that was thrown.
    `verbosityLevel` - what type of message is this? (WARNING/DEBUG/INFO etc)

### flush

    public void flush()

  Flush the log.

### close

    public void close()

  Close the log.

### setLevel

    public void setLevel(int level)

  Set the verbosity level for this logger. This controls how the logs will be filtered.

  Parameters:
    `level` - one of the verbosity level codes.

### getLevel

    public int getLevel()

  Get the current verbosity level.

### setDefaultSink

    public static void setDefaultSink(java.io.Writer w)

  Set the default output stream that is used by all logging channels.

  Parameters:
    `w` - the default output stream.

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

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