|
|||||||||
| Home >> All >> org >> mortbay >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mortbay.util
Class Log

java.lang.Objectorg.mortbay.util.Log
- public class Log
- extends java.lang.Object
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.
| Nested Class Summary | |
private static class |
Log.Singleton
|
| Field Summary | |
private boolean |
_initialized
|
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
|
| Constructor Summary | |
private |
Log()
Construct the shared instance of Log that decodes the options setup in the environments properties. |
| Method Summary | |
void |
add(LogSink logSink)
Add a Log Sink. |
void |
add(java.lang.String logSinkClass)
Add a Log Sink. |
private void |
defaultInit()
Default initialization is used the first time we have to log unless a sink has been added with add(). |
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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DEBUG
public static final java.lang.String DEBUG
- See Also:
- Constant Field Values
EVENT
public static final java.lang.String EVENT
- See Also:
- Constant Field Values
WARN
public static final java.lang.String WARN
- See Also:
- Constant Field Values
ASSERT
public static final java.lang.String ASSERT
- See Also:
- Constant Field Values
FAIL
public static final java.lang.String FAIL
- See Also:
- Constant Field Values
_sinks
public LogSink[] _sinks
_logOptions
public java.lang.String _logOptions
_initialized
private boolean _initialized
| Constructor Detail |
Log
private Log()
- Construct the shared instance of Log that decodes the
options setup in the environments properties.
| Method Detail |
instance
public static Log instance()
defaultInit
private void defaultInit()
- Default initialization is used the first time we have to log
unless a sink has been added with add(). _needInit allows us to
distinguish between initial state and disabled state.
add
public void add(java.lang.String logSinkClass)
- Add a Log Sink.
add
public void add(LogSink logSink)
- Add a Log Sink.
getLogSinks
public LogSink[] getLogSinks()
deleteStoppedLogSinks
public void deleteStoppedLogSinks()
disableLog
public void disableLog()
- No logging.
All log sinks are stopped and removed.
message
public static void message(java.lang.String tag, java.lang.Object msg, Frame frame)
event
public static void event(java.lang.Object message, int stackDepth)
- Log an event.
event
public static void event(java.lang.Object message)
- Log an event.
warning
public static void warning(java.lang.Object message, int stackDepth)
- Log a warning message.
warning
public static void warning(java.lang.Object message)
- Log a warning.
message
public void message(java.lang.String tag, java.lang.Object msg, Frame frame, long time)
- Log a message.
message
public void message(java.lang.String tag, java.lang.String msg)
- Log a message.
setOptions
public void setOptions(java.lang.String logOptions)
getOptions
public java.lang.String getOptions()
|
|||||||||
| Home >> All >> org >> mortbay >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.mortbay.util.Log