|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.util.OutputStreamLogSink
A Log sink. This class represents both a concrete or abstract sink of Log data. The default implementation logs to System.err, but other output stream or files may be specified. Currently this Stream only writes in ISO8859_1 encoding. For Other encodings use the less efficient WriterLogSink. If a logFilename is specified, output is sent to that file. If the filename contains "yyyy_mm_dd", the log file date format is used to create the actual filename and the log file is rolled over at local midnight. If append is set, existing logfiles are appended to, otherwise a backup is created with a timestamp. Dated log files are deleted after retain days.
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. Default value: HH:mm:ss.SSS
If LOG_TIMEZONE is set, it is used to set the timezone of the log date format, otherwise GMT is used.
If LOG_FILE_BACKUP_FORMAT is set, it is used as a format string for java.text.SimpleDateFormat and used to suffix the existing log file when it is backed up - log files are backed up when this class starts and finds the log file already exists and append is set to false (append is on by default, so this only needs to be overridden if append is turned off). Default value: HHmmssSSS
If LOG_FILE_RETAIN_DAYS is set, it is used to set the number of days after which old log files will be deleted. Default: 31
If LOG_FILE_DATE_FORMAT is set, it is used as a format string for java.text.SimpleDateFormat and used to format the date part of the log file name. Default value: yyyy_MM_dd
Log
Field Summary | |
static char |
OPT_LABEL
|
static char |
OPT_ONELINE
|
static char |
OPT_STACKSIZE
|
static char |
OPT_STACKTRACE
|
static char |
OPT_TAG
|
static char |
OPT_TIMESTAMP
|
Constructor Summary | |
OutputStreamLogSink()
Constructor. |
|
OutputStreamLogSink(java.lang.String filename)
|
Method Summary | |
void |
destroy()
Destroy the LifeCycle. |
java.lang.String |
getFilename()
|
boolean |
getFlushOn()
|
java.lang.String |
getLogDateFormat()
|
java.lang.String |
getLogTimezone()
|
java.lang.String |
getOptions()
|
java.io.OutputStream |
getOutputStream()
|
int |
getRetainDays()
|
boolean |
isAppend()
|
boolean |
isDestroyed()
|
boolean |
isLogLabels()
|
boolean |
isLogOneLine()
|
boolean |
isLogStackSize()
|
boolean |
isLogStackTrace()
|
boolean |
isLogTags()
|
boolean |
isLogTimeStamps()
|
boolean |
isStarted()
|
void |
log(java.lang.String formattedLog)
Log a message. |
void |
log(java.lang.String tag,
java.lang.Object msg,
Frame frame,
long time)
Log a message. |
void |
setAppend(boolean a)
|
void |
setFilename(java.lang.String filename)
|
void |
setFlushOn(boolean on)
|
void |
setLogDateFormat(java.lang.String logDateFormat)
|
void |
setLogLabels(boolean logLabels)
|
void |
setLogOneLine(boolean logOneLine)
|
void |
setLogStackSize(boolean logStackSize)
|
void |
setLogStackTrace(boolean logStackTrace)
|
void |
setLogTags(boolean logTags)
|
void |
setLogTimeStamps(boolean logTimeStamps)
|
void |
setLogTimezone(java.lang.String logTimezone)
|
void |
setOptions(boolean logTimeStamps,
boolean logLabels,
boolean logTags,
boolean logStackSize,
boolean logStackTrace,
boolean logOneLine)
Set the log options. |
void |
setOptions(java.lang.String logOptions)
Set the log options. |
void |
setOutputStream(java.io.OutputStream out)
|
void |
setRetainDays(int retainDays)
|
void |
start()
Start a log sink. |
void |
stop()
Stop a log sink. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final char OPT_TIMESTAMP
public static final char OPT_LABEL
public static final char OPT_TAG
public static final char OPT_STACKSIZE
public static final char OPT_STACKTRACE
public static final char OPT_ONELINE
Constructor Detail |
public OutputStreamLogSink() throws java.io.IOException
public OutputStreamLogSink(java.lang.String filename)
Method Detail |
public void setOptions(java.lang.String logOptions)
LogSink
setOptions
in interface LogSink
org.mortbay.util.LogSink
logOptions
- A string of characters as defined for the
LOG_OPTIONS system parameter.public java.lang.String getOptions()
getOptions
in interface LogSink
public void setOptions(boolean logTimeStamps, boolean logLabels, boolean logTags, boolean logStackSize, boolean logStackTrace, boolean logOneLine)
logOptions
- A string of characters as defined for the
LOG_OPTIONS system parameter.public java.lang.String getLogDateFormat()
public void setLogDateFormat(java.lang.String logDateFormat)
public java.lang.String getLogTimezone()
public void setLogTimezone(java.lang.String logTimezone)
public boolean isLogTimeStamps()
public void setLogTimeStamps(boolean logTimeStamps)
public boolean isLogLabels()
public void setLogLabels(boolean logLabels)
public boolean isLogTags()
public void setLogTags(boolean logTags)
public boolean isLogStackSize()
public void setLogStackSize(boolean logStackSize)
public boolean isLogStackTrace()
public void setLogStackTrace(boolean logStackTrace)
public boolean isLogOneLine()
public void setLogOneLine(boolean logOneLine)
public boolean isAppend()
public void setAppend(boolean a)
public void setOutputStream(java.io.OutputStream out)
public java.io.OutputStream getOutputStream()
public void setFilename(java.lang.String filename)
public java.lang.String getFilename()
public int getRetainDays()
public void setRetainDays(int retainDays)
public void setFlushOn(boolean on)
on
- If true, log is flushed on every log.public boolean getFlushOn()
public void log(java.lang.String tag, java.lang.Object msg, Frame frame, long time)
log
in interface LogSink
tag
- Tag for type of logmsg
- The messageframe
- The frame that generated the message.time
- The time stamp of the message.public void log(java.lang.String formattedLog)
log
in interface LogSink
formattedLog
- public void start()
start
in interface LifeCycle
org.mortbay.util.LifeCycle
java.lang.Exception
- An arbitrary exception may be thrown.public void stop()
stop
in interface LifeCycle
public boolean isStarted()
isStarted
in interface LifeCycle
org.mortbay.util.LifeCycle
public void destroy()
LifeCycle
destroy
in interface LifeCycle
public boolean isDestroyed()
isDestroyed
in interface LifeCycle
org.mortbay.util.LifeCycle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |