public class Log extends Object implements com.sun.org.apache.commons.logging.Log
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.| Modifier and Type | Field and Description |
|---|---|
static int |
DEBUG
Deprecated.
|
static int |
ERROR
Deprecated.
|
static int |
FATAL
Deprecated.
Verbosity level codes.
|
static int |
INFORMATION
Deprecated.
|
protected String |
logname
Deprecated.
|
protected String |
prefix
Deprecated.
|
static int |
WARNING
Deprecated.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Log(String channel,
String prefix,
LogHandler proxy,
Object owner)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Deprecated.
|
void |
debug(Object message)
Deprecated.
|
void |
debug(Object message,
Throwable exception)
Deprecated.
|
void |
error(Object message)
Deprecated.
|
void |
error(Object message,
Throwable exception)
Deprecated.
|
void |
fatal(Object message)
Deprecated.
|
void |
fatal(Object message,
Throwable exception)
Deprecated.
|
void |
flush()
Deprecated.
Flush any buffers.
|
String |
getChannel(LogManager lm)
Deprecated.
|
int |
getLevel()
Deprecated.
The configured logging level for this channel
|
static Log |
getLog(String channel,
Object owner)
Deprecated.
|
static Log |
getLog(String channel,
String prefix)
Deprecated.
|
void |
info(Object message)
Deprecated.
|
void |
info(Object message,
Throwable exception)
Deprecated.
|
boolean |
isDebugEnabled()
Deprecated.
|
boolean |
isErrorEnabled()
Deprecated.
|
boolean |
isFatalEnabled()
Deprecated.
|
boolean |
isInfoEnabled()
Deprecated.
|
boolean |
isTraceEnabled()
Deprecated.
|
boolean |
isWarnEnabled()
Deprecated.
|
void |
log(String msg)
Deprecated.
Logs the message with level INFORMATION
|
void |
log(String msg,
int level)
Deprecated.
Logs the message with given level
|
void |
log(String prefix,
String msg,
Throwable t,
int level)
Deprecated.
|
void |
log(String msg,
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(String msg,
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(Object message)
Deprecated.
|
void |
trace(Object message,
Throwable exception)
Deprecated.
|
void |
warn(Object message)
Deprecated.
|
void |
warn(Object message,
Throwable exception)
Deprecated.
|
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 final String logname
protected final String prefix
protected Log(String channel, String prefix, LogHandler proxy, Object owner)
public static Log getLog(String channel, String prefix)
logname - name of log to useowner - object whose class name to use as prefixpublic static Log getLog(String channel, Object owner)
logname - name of log to useprefix - string to prepend to each messagepublic void log(String msg)
public void log(String msg, Throwable t)
public void log(String msg, int level)
public void log(String msg, Throwable t, int level)
public void flush()
public void close()
public int getLevel()
public static LogManager setLogManager(LogManager lm)
public String getChannel(LogManager lm)
public void setProxy(LogManager lm, LogHandler l)
public void debug(Object message)
debug in interface com.sun.org.apache.commons.logging.Logpublic void debug(Object message, Throwable exception)
debug in interface com.sun.org.apache.commons.logging.Logpublic void error(Object message)
error in interface com.sun.org.apache.commons.logging.Logpublic void error(Object message, Throwable exception)
error in interface com.sun.org.apache.commons.logging.Logpublic void fatal(Object message)
fatal in interface com.sun.org.apache.commons.logging.Logpublic void fatal(Object message, Throwable exception)
fatal in interface com.sun.org.apache.commons.logging.Logpublic void info(Object message)
info in interface com.sun.org.apache.commons.logging.Logpublic void info(Object message, Throwable exception)
info in interface com.sun.org.apache.commons.logging.Logpublic void trace(Object message)
trace in interface com.sun.org.apache.commons.logging.Logpublic void trace(Object message, Throwable exception)
trace in interface com.sun.org.apache.commons.logging.Logpublic void warn(Object message)
warn in interface com.sun.org.apache.commons.logging.Logpublic void warn(Object message, Throwable exception)
warn in interface com.sun.org.apache.commons.logging.Logpublic boolean isDebugEnabled()
isDebugEnabled in interface com.sun.org.apache.commons.logging.Logpublic boolean isErrorEnabled()
isErrorEnabled in interface com.sun.org.apache.commons.logging.Logpublic boolean isFatalEnabled()
isFatalEnabled in interface com.sun.org.apache.commons.logging.Logpublic boolean isInfoEnabled()
isInfoEnabled in interface com.sun.org.apache.commons.logging.Logpublic boolean isTraceEnabled()
isTraceEnabled in interface com.sun.org.apache.commons.logging.Logpublic boolean isWarnEnabled()
isWarnEnabled in interface com.sun.org.apache.commons.logging.LogCopyright © 2005–2017 Oracle Corporation. All rights reserved.