|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tomcat.util.log.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.
| 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 |
public static final int FATAL
public static final int ERROR
public static final int WARNING
public static final int INFORMATION
public static final int DEBUG
protected java.lang.String logname
protected java.lang.String prefix
| Constructor Detail |
protected Log(java.lang.String channel,
java.lang.String prefix,
LogHandler proxy,
java.lang.Object owner)
| Method Detail |
public static Log getLog(java.lang.String channel,
java.lang.String prefix)
public static Log getLog(java.lang.String channel,
java.lang.Object owner)
public void log(java.lang.String msg)
public void log(java.lang.String msg,
java.lang.Throwable t)
public void log(java.lang.String msg,
int level)
public void log(java.lang.String msg,
java.lang.Throwable t,
int level)
public void log(java.lang.String prefix,
java.lang.String msg,
java.lang.Throwable t,
int level)
public void flush()
public void close()
public int getLevel()
public static LogManager setLogManager(LogManager lm)
public java.lang.String getChannel(LogManager lm)
public void setProxy(LogManager lm,
LogHandler l)
public void debug(java.lang.Object message)
debug in interface org.apache.commons.logging.Log
public void debug(java.lang.Object message,
java.lang.Throwable exception)
debug in interface org.apache.commons.logging.Logpublic void error(java.lang.Object message)
error in interface org.apache.commons.logging.Log
public void error(java.lang.Object message,
java.lang.Throwable exception)
error in interface org.apache.commons.logging.Logpublic void fatal(java.lang.Object message)
fatal in interface org.apache.commons.logging.Log
public void fatal(java.lang.Object message,
java.lang.Throwable exception)
fatal in interface org.apache.commons.logging.Logpublic void info(java.lang.Object message)
info in interface org.apache.commons.logging.Log
public void info(java.lang.Object message,
java.lang.Throwable exception)
info in interface org.apache.commons.logging.Logpublic void trace(java.lang.Object message)
trace in interface org.apache.commons.logging.Log
public void trace(java.lang.Object message,
java.lang.Throwable exception)
trace in interface org.apache.commons.logging.Logpublic void warn(java.lang.Object message)
warn in interface org.apache.commons.logging.Log
public void warn(java.lang.Object message,
java.lang.Throwable exception)
warn in interface org.apache.commons.logging.Logpublic boolean isDebugEnabled()
isDebugEnabled in interface org.apache.commons.logging.Logpublic boolean isErrorEnabled()
isErrorEnabled in interface org.apache.commons.logging.Logpublic boolean isFatalEnabled()
isFatalEnabled in interface org.apache.commons.logging.Logpublic boolean isInfoEnabled()
isInfoEnabled in interface org.apache.commons.logging.Logpublic boolean isTraceEnabled()
isTraceEnabled in interface org.apache.commons.logging.Logpublic boolean isWarnEnabled()
isWarnEnabled in interface org.apache.commons.logging.Log
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||