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

## org.apache.tomcat.util.qlog
Class Logger

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

Direct Known Subclasses:
  QueueLogger

public abstract class Logger
extends LogHandler

Interface for a logging object. A logging object provides mechanism for logging errors and messages that are of interest to someone who is trying to monitor the system.

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

Field Summary
`protected boolean` | `custom`
`protected long` | `day`
`protected static java.io.PrintWriter` | `defaultSink`
`static int` | `MAX_THROWABLE_DEPTH`
`static char[]` | `NEWLINE`
`protected java.lang.String` | `path`
`protected boolean` | `timestamp` Should we timestamp this log at all?
`protected java.lang.String` | `timestampFormat` The timestamp format string, default is "yyyy-MM-dd HH:mm:ss"
`protected java.text.DateFormat` | `timestampFormatter`
`protected boolean` | `timestampRaw` true = The timestamp format is raw msec-since-epoch false = The timestamp format is a custom string to pass to SimpleDateFormat

Fields inherited from class org.apache.tomcat.util.log.LogHandler
`level, sink`

Constructor Summary
`Logger()`

Method Summary
`protected java.lang.String` | `formatTimestamp(long msec)`
`protected void` | `formatTimestamp(long msec, java.lang.StringBuffer buf)`
`protected java.lang.String` | `getDatePrefix(long millis, java.lang.String format)`
`protected long` | `getDay(long millis)`
`int` | `getLevel()` Get the current verbosity level.
`java.lang.String` | `getPath()`
`java.lang.String` | `getTimestampFormat()`
`int` | `getVerbosityLevel()` Get the current verbosity level.
`boolean` | `isTimestamp()`
`void` | `open()` Open the log - will create the log file and all the parent directories.
`static void` | `setDefaultSink(java.io.Writer w)` Set the default output stream that is used by all logging channels.
`void` | `setPath(java.lang.String path)` Set the path name for the log output file.
`void` | `setTimestamp(java.lang.String value)` Do we need to time stamp this or not?
`void` | `setTimestampFormat(java.lang.String value)` If we are timestamping at all, what format do we use to print the timestamp? See java.text.SimpleDateFormat.
`void` | `setVerbosityLevel(int level)` Set the verbosity level for this logger.
`void` | `setVerbosityLevel(java.lang.String level)` Set the verbosity level for this logger.
`static java.lang.String` | `throwableToString(java.lang.Throwable t)` Converts a Throwable to a printable stack trace, including the nested root cause for a ServletException or TomcatException if applicable TODO: JDBCException too
`static java.lang.String` | `throwableToString(java.lang.Throwable t, java.lang.String rootcause)` Converts a Throwable to a printable stack trace, including the nested root cause for a ServletException or TomcatException or SQLException if applicable

Methods inherited from class org.apache.tomcat.util.log.LogHandler
`close, flush, log, setLevel`

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

Field Detail

### defaultSink

    protected static java.io.PrintWriter defaultSink

### day

    protected long day

### NEWLINE

    public static final char[] NEWLINE

### custom

    protected boolean custom

### path

    protected java.lang.String path

### timestamp

    protected boolean timestamp

  Should we timestamp this log at all?

### timestampRaw

    protected boolean timestampRaw

  true = The timestamp format is raw msec-since-epoch
  false = The timestamp format is a custom string to pass to SimpleDateFormat

### timestampFormat

    protected java.lang.String timestampFormat

  The timestamp format string, default is "yyyy-MM-dd HH:mm:ss"

### timestampFormatter

    protected java.text.DateFormat timestampFormatter

### MAX_THROWABLE_DEPTH

    public static final int MAX_THROWABLE_DEPTH

See Also:
  Constant Field Values

Constructor Detail

### Logger

    public Logger()

Method Detail

### 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.

### setPath

    public void setPath(java.lang.String path)

  Set the path name for the log output file.

  Parameters:
    `path` - The path to the log file.

### getPath

    public java.lang.String getPath()

### open

    public void open()

  Open the log - will create the log file and all the parent directories. You must open the logger before use, or it will write to System.err

### setVerbosityLevel

    public void setVerbosityLevel(java.lang.String level)

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

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

### setVerbosityLevel

    public void setVerbosityLevel(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.

### getVerbosityLevel

    public int getVerbosityLevel()

  Get the current verbosity level.

### getLevel

    public int getLevel()

  Get the current verbosity level.

  Overrides:
    `getLevel` in class `LogHandler`

### setTimestamp

    public void setTimestamp(java.lang.String value)

  Do we need to time stamp this or not?

  Parameters:
    `value` - "yes/no" or "true/false"

### isTimestamp

    public boolean isTimestamp()

### setTimestampFormat

    public void setTimestampFormat(java.lang.String value)

  If we are timestamping at all, what format do we use to print the timestamp? See java.text.SimpleDateFormat. Default = "yyyy-MM-dd hh:mm:ss". Special case: "msec" => raw number of msec since epoch, very efficient but not user-friendly

### getTimestampFormat

    public java.lang.String getTimestampFormat()

### formatTimestamp

    protected java.lang.String formatTimestamp(long msec)

### formatTimestamp

    protected void formatTimestamp(long msec,
                                   java.lang.StringBuffer buf)

### getDatePrefix

    protected java.lang.String getDatePrefix(long millis,
                                             java.lang.String format)

### getDay

    protected long getDay(long millis)

### throwableToString

    public static java.lang.String throwableToString(java.lang.Throwable t)

  Converts a Throwable to a printable stack trace, including the nested root cause for a ServletException or TomcatException if applicable TODO: JDBCException too

  Parameters:
    `t` - any Throwable, or ServletException, or null

### throwableToString

    public static java.lang.String throwableToString(java.lang.Throwable t,
                                                     java.lang.String rootcause)

  Converts a Throwable to a printable stack trace, including the nested root cause for a ServletException or TomcatException or SQLException if applicable

  Parameters:
    `t` - any Throwable, or ServletException, or null
    `rootcause` - localized string equivalent of "Root Cause"

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

Copyright © 2001 Apache Software Foundation. All Rights Reserved.