org.apache.tomcat.util.log
Class Log

java.lang.Object
  extended byorg.apache.tomcat.util.log.Log
All Implemented Interfaces:
org.apache.commons.logging.Log

Deprecated. Commons-logging should be used instead.

public class Log
extends java.lang.Object
implements org.apache.commons.logging.Log

This is the main class seen by objects that need to log. It has a log channel to write to; if it can't find a log with that name, it outputs to the default sink. Also prepends a descriptive name to each message (usually the toString() of the calling object), so it's easier to identify the source.

Intended for use by client classes to make it easy to do reliable, consistent logging behavior, even if you don't necessarily have a context, or if you haven't registered any log files yet, or if you're in a non-Tomcat application.

Usage:

 class Foo {
   Log log = Log.getLog("tc_log", "Foo"); // or...
   Log log = Log.getLog("tc_log", this); // fills in "Foo" for you
   ...
     log.log("Something happened");
     ...
     log.log("Starting something", Log.DEBUG);
     ...
     catch (IOException e) {
       log.log("While doing something", e);
     }
 
As a special feature ( required in tomcat operation ) the Log can be modified at run-time, by changing and configuring the logging implementation ( without requiring any special change in the user code ). That means that the user can do a Log.getLog() at any time, even before the logging system is fully configured. The embeding application can then set up or change the logging details, without any action from the log user.

Author:
Alex Chaffee [alex@jguru.com], Costin Manolache

Field Summary
static int DEBUG
          Deprecated.  
static int ERROR
          Deprecated.  
static int FATAL
          Deprecated. Verbosity level codes.
static int INFORMATION
          Deprecated.  
protected  java.lang.String logname
          Deprecated.  
protected  java.lang.String prefix
          Deprecated.  
static int WARNING
          Deprecated.  
 
Constructor Summary
protected Log(java.lang.String channel, java.lang.String prefix, LogHandler proxy, java.lang.Object owner)
          Deprecated.  
 
Method Summary
 void close()
          Deprecated.  
 void debug(java.lang.Object message)
          Deprecated.  
 void debug(java.lang.Object message, java.lang.Throwable exception)
          Deprecated.  
 void error(java.lang.Object message)
          Deprecated.  
 void error(java.lang.Object message, java.lang.Throwable exception)
          Deprecated.  
 void fatal(java.lang.Object message)
          Deprecated.  
 void fatal(java.lang.Object message, java.lang.Throwable exception)
          Deprecated.  
 void flush()
          Deprecated. Flush any buffers.
 java.lang.String getChannel(LogManager lm)
          Deprecated.  
 int getLevel()
          Deprecated. The configured logging level for this channel
static Log getLog(java.lang.String channel, java.lang.Object owner)
          Deprecated.  
static Log getLog(java.lang.String channel, java.lang.String prefix)
          Deprecated.  
 void info(java.lang.Object message)
          Deprecated.  
 void info(java.lang.Object message, java.lang.Throwable exception)
          Deprecated.  
 boolean isDebugEnabled()
          Deprecated.  
 boolean isErrorEnabled()
          Deprecated.  
 boolean isFatalEnabled()
          Deprecated.  
 boolean isInfoEnabled()
          Deprecated.  
 boolean isTraceEnabled()
          Deprecated.  
 boolean isWarnEnabled()
          Deprecated.  
 void log(java.lang.String msg)
          Deprecated. Logs the message with level INFORMATION
 void log(java.lang.String msg, int level)
          Deprecated. Logs the message with given level
 void log(java.lang.String prefix, java.lang.String msg, java.lang.Throwable t, int level)
          Deprecated.  
 void log(java.lang.String msg, java.lang.Throwable t)
          Deprecated. Logs the Throwable with level ERROR (assumes an exception is trouble; if it's not, use log(msg, t, level))
 void log(java.lang.String msg, java.lang.Throwable t, int level)
          Deprecated. Logs the message and Throwable to its logger or, if logger not found, to the default logger, which writes to the default sink, which is usually System.err
static LogManager setLogManager(LogManager lm)
          Deprecated. Used by the embeding application ( tomcat ) to manage the logging.
 void setProxy(LogManager lm, LogHandler l)
          Deprecated.  
 void trace(java.lang.Object message)
          Deprecated.  
 void trace(java.lang.Object message, java.lang.Throwable exception)
          Deprecated.  
 void warn(java.lang.Object message)
          Deprecated.  
 void warn(java.lang.Object message, java.lang.Throwable exception)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FATAL

public static final int FATAL
Deprecated. 
Verbosity level codes.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Deprecated. 
See Also:
Constant Field Values

WARNING

public static final int WARNING
Deprecated. 
See Also:
Constant Field Values

INFORMATION

public static final int INFORMATION
Deprecated. 
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
Deprecated. 
See Also:
Constant Field Values

logname

protected java.lang.String logname
Deprecated. 

prefix

protected java.lang.String prefix
Deprecated. 
Constructor Detail

Log

protected Log(java.lang.String channel,
              java.lang.String prefix,
              LogHandler proxy,
              java.lang.Object owner)
Deprecated. 
Method Detail

getLog

public static Log getLog(java.lang.String channel,
                         java.lang.String prefix)
Deprecated. 

getLog

public static Log getLog(java.lang.String channel,
                         java.lang.Object owner)
Deprecated. 

log

public void log(java.lang.String msg)
Deprecated. 
Logs the message with level INFORMATION


log

public void log(java.lang.String msg,
                java.lang.Throwable t)
Deprecated. 
Logs the Throwable with level ERROR (assumes an exception is trouble; if it's not, use log(msg, t, level))


log

public void log(java.lang.String msg,
                int level)
Deprecated. 
Logs the message with given level


log

public void log(java.lang.String msg,
                java.lang.Throwable t,
                int level)
Deprecated. 
Logs the message and Throwable to its logger or, if logger not found, to the default logger, which writes to the default sink, which is usually System.err


log

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

flush

public void flush()
Deprecated. 
Flush any buffers. Override if needed.


close

public void close()
Deprecated. 

getLevel

public int getLevel()
Deprecated. 
The configured logging level for this channel


setLogManager

public static LogManager setLogManager(LogManager lm)
Deprecated. 
Used by the embeding application ( tomcat ) to manage the logging. Initially, the Log is not managed, and the default manager is used. The application can find what loggers have been created from the default LogManager, and provide a special manager implemetation.


getChannel

public java.lang.String getChannel(LogManager lm)
Deprecated. 

setProxy

public void setProxy(LogManager lm,
                     LogHandler l)
Deprecated. 

debug

public void debug(java.lang.Object message)
Deprecated. 
Specified by:
debug in interface org.apache.commons.logging.Log

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable exception)
Deprecated. 
Specified by:
debug in interface org.apache.commons.logging.Log

error

public void error(java.lang.Object message)
Deprecated. 
Specified by:
error in interface org.apache.commons.logging.Log

error

public void error(java.lang.Object message,
                  java.lang.Throwable exception)
Deprecated. 
Specified by:
error in interface org.apache.commons.logging.Log

fatal

public void fatal(java.lang.Object message)
Deprecated. 
Specified by:
fatal in interface org.apache.commons.logging.Log

fatal

public void fatal(java.lang.Object message,
                  java.lang.Throwable exception)
Deprecated. 
Specified by:
fatal in interface org.apache.commons.logging.Log

info

public void info(java.lang.Object message)
Deprecated. 
Specified by:
info in interface org.apache.commons.logging.Log

info

public void info(java.lang.Object message,
                 java.lang.Throwable exception)
Deprecated. 
Specified by:
info in interface org.apache.commons.logging.Log

trace

public void trace(java.lang.Object message)
Deprecated. 
Specified by:
trace in interface org.apache.commons.logging.Log

trace

public void trace(java.lang.Object message,
                  java.lang.Throwable exception)
Deprecated. 
Specified by:
trace in interface org.apache.commons.logging.Log

warn

public void warn(java.lang.Object message)
Deprecated. 
Specified by:
warn in interface org.apache.commons.logging.Log

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable exception)
Deprecated. 
Specified by:
warn in interface org.apache.commons.logging.Log

isDebugEnabled

public boolean isDebugEnabled()
Deprecated. 
Specified by:
isDebugEnabled in interface org.apache.commons.logging.Log

isErrorEnabled

public boolean isErrorEnabled()
Deprecated. 
Specified by:
isErrorEnabled in interface org.apache.commons.logging.Log

isFatalEnabled

public boolean isFatalEnabled()
Deprecated. 
Specified by:
isFatalEnabled in interface org.apache.commons.logging.Log

isInfoEnabled

public boolean isInfoEnabled()
Deprecated. 
Specified by:
isInfoEnabled in interface org.apache.commons.logging.Log

isTraceEnabled

public boolean isTraceEnabled()
Deprecated. 
Specified by:
isTraceEnabled in interface org.apache.commons.logging.Log

isWarnEnabled

public boolean isWarnEnabled()
Deprecated. 
Specified by:
isWarnEnabled in interface org.apache.commons.logging.Log


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