|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mortbay.Base.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 com.mortbay.Base.LogSink - log to System.err com.mortbay.Base.FileLogSink - log to file whose name is in LOG_FILE com.mortbay.Base.RolloverFileLogSink - log to daily rollover logs
If the property LOG_CLASSES is missing, a single LogSink is used to output to System.err.
If the property LOG_DATE_FORMAT is set, then it is interpreted as a format string for java.text.SimpleDateFormat and used to format the log timestamps. Note: The character '+' is replaced with space in the date format string. If LOG_TIMEZONE is set, it is used to set the timezone of the log date format, otherwise GMT is used.
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.
Field Summary | |
java.lang.String |
_logOptions
|
LogSink[] |
_sinks
|
static java.lang.String |
CODE_ASSERT
|
static java.lang.String |
CODE_DEBUG
|
static java.lang.String |
CODE_FAIL
|
static java.lang.String |
CODE_WARN
|
static java.lang.String |
EVENT
|
static char |
LABEL
|
static char |
ONELINE
|
static char |
STACKSIZE
|
static char |
STACKTRACE
|
static char |
TAG
|
static char |
TIMESTAMP
|
static java.lang.String |
WARN
|
Method Summary | |
void |
add(LogSink logSink)
Add a Log Sink. |
void |
disableLog()
No logging. |
static void |
event(java.lang.String message)
Log an event |
static void |
event(java.lang.String message,
int stackDepth)
Log an event |
static java.lang.String |
getEVENT()
|
java.lang.String |
getOptions()
|
static void |
initParamsFromApplet(java.applet.Applet appl)
Initialize default behaviour from applet parameters Initializes the default instance from applet parameters of the same name as the system properties used to config Log |
static Log |
instance()
|
static void |
message(java.lang.String tag,
java.lang.String msg,
Frame frame)
|
void |
message(java.lang.String tag,
java.lang.String msg,
Frame frame,
long time)
Log a message |
void |
setOptions(java.lang.String logOptions)
|
void |
setOptions(java.lang.String logOptions,
java.lang.String logFile,
java.lang.String dateFormat,
java.lang.String timezone)
|
static void |
warning(java.lang.String message)
Log an warning |
static void |
warning(java.lang.String message,
int stackDepth)
Log an warning |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String EVENT
public static final java.lang.String WARN
public static final java.lang.String CODE_ASSERT
public static final java.lang.String CODE_WARN
public static final java.lang.String CODE_FAIL
public static final java.lang.String CODE_DEBUG
public static char TIMESTAMP
public static char LABEL
public static char TAG
public static char STACKSIZE
public static char STACKTRACE
public static char ONELINE
public LogSink[] _sinks
public java.lang.String _logOptions
Method Detail |
public static java.lang.String getEVENT()
public static Log instance()
public static void initParamsFromApplet(java.applet.Applet appl)
appl
- Appletpublic void add(LogSink logSink)
logSink
- public void disableLog()
public static void message(java.lang.String tag, java.lang.String msg, Frame frame)
public void message(java.lang.String tag, java.lang.String 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 static void event(java.lang.String message, int stackDepth)
public static void event(java.lang.String message)
public static void warning(java.lang.String message, int stackDepth)
public static void warning(java.lang.String message)
public void setOptions(java.lang.String logOptions, java.lang.String logFile, java.lang.String dateFormat, java.lang.String timezone)
public void setOptions(java.lang.String logOptions)
public java.lang.String getOptions()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |