|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.util.Log
Log formatted and tagged messages. Multiple LogSinks instances can be configured, but by default a System.err sink is created.
The Log log format is controlled by the LOG_OPTIONS property supplied to the VM.
If LOG_OPTIONS is set, then the default output format is controlled by the option characters in the string:
t Timestamp log output T Show the log tag name L Show log label (thread, method and file names). s Show indication of stack depth S Stack trace for each output line (VERY VERBOSE) O Place each log one One line of output
If the property LOG_CLASSES is set, it is interpreted as a semi-colon-separated list of fully-qualified LogSink class names. An instance of each class, created with a default constructor, is added to the list of log sinks. Some possibilities for LOG_CLASSES are org.mortbay.util.OutputStreamLogSink - log to System.err, a file whose name is specified in LOG_FILE, and optionally rollover the logs on a daily basis. See the javadoc for org.mortbay.util.OutputStreamLogSink for information on the options LOG_DATE_FORMAT, LOG_FILE_BACKUP_FORMAT, LOG_FILE_RETAIN_DAYS, LOG_FILE_DATE_FORMAT and LOG_TIME_ZONE.
If the property LOG_CLASSES is missing, a single OutputStreamLogSink is used to output to System.err.
As an alternative to the above behavior, you can create LogSinks in code and add() them to the Log. If you do this before the first use of the log, the default initialization will be skipped.
OutputStreamLogSink
Field Summary | |
java.lang.String |
_logOptions
|
LogSink[] |
_sinks
|
static java.lang.String |
ASSERT
|
static java.lang.String |
DEBUG
|
static java.lang.String |
EVENT
|
static java.lang.String |
FAIL
|
static java.lang.String |
WARN
|
Method Summary | |
void |
add(LogSink logSink)
Add a Log Sink. |
void |
add(java.lang.String logSinkClass)
Add a Log Sink. |
void |
deleteStoppedLogSinks()
|
void |
disableLog()
No logging. |
static void |
event(java.lang.Object message)
Log an event. |
static void |
event(java.lang.Object message,
int stackDepth)
Log an event. |
LogSink[] |
getLogSinks()
|
java.lang.String |
getOptions()
|
static Log |
instance()
|
static void |
message(java.lang.String tag,
java.lang.Object msg,
Frame frame)
|
void |
message(java.lang.String tag,
java.lang.Object msg,
Frame frame,
long time)
Log a message. |
void |
message(java.lang.String tag,
java.lang.String msg)
Log a message. |
void |
setOptions(java.lang.String logOptions)
|
static void |
warning(java.lang.Object message)
Log a warning. |
static void |
warning(java.lang.Object message,
int stackDepth)
Log a warning message. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DEBUG
public static final java.lang.String EVENT
public static final java.lang.String WARN
public static final java.lang.String ASSERT
public static final java.lang.String FAIL
public LogSink[] _sinks
public java.lang.String _logOptions
Method Detail |
public static Log instance()
public void add(java.lang.String logSinkClass)
logSinkClass
- The logsink classname or null for the default.public void add(LogSink logSink)
logSink
- public LogSink[] getLogSinks()
public void deleteStoppedLogSinks()
public void disableLog()
public static void message(java.lang.String tag, java.lang.Object msg, Frame frame)
public static void event(java.lang.Object message, int stackDepth)
public static void event(java.lang.Object message)
public static void warning(java.lang.Object message, int stackDepth)
message
- the Object to use as a warning message.stackDepth
- number of levels of stack to ignore.for warnings of exceptions etc.
public static void warning(java.lang.Object message)
message
- the Object to use as a warning message.for warnings of exceptions etc.
public void message(java.lang.String tag, java.lang.Object msg, Frame frame, long time)
tag
- Tag for type of logmsg
- The messageframe
- The frame that generated the message.time
- The time stamp of the message.public void message(java.lang.String tag, java.lang.String msg)
tag
- Tag for type of logmsg
- The messagepublic void setOptions(java.lang.String logOptions)
public java.lang.String getOptions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |