|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread marf.util.BaseThread marf.util.Logger
public class Logger
MARF Runnable Logging Facility.
All methods are properly synchronized should multiple threads access the same logger.
$Id: Logger.java,v 1.10 2007/12/23 06:29:47 mokhov Exp $
Nested Class Summary | |
---|---|
class |
Logger.LogPrintStream
Our own LogPrintStream for log delivery. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected boolean |
bAvailable
Indicates if logging is available. |
protected boolean |
bNoTimestamp
If set to true , no timestamp is issued with a message. |
protected int |
iLogDirection
Indicates where the log should go. |
static int |
LOG_STDERR_TO_FILE
Indicates to redirect STDERR to a file. |
static int |
LOG_STDOUT_STDERR_TO_FILE
Indicates to redirect STDOUT and STDERR to a file. |
static int |
LOG_STDOUT_TO_FILE
Indicates to redirect STDOUT to a file. |
static int |
LOG_TO_FILE_STDOUT_STDERR
Indicates to emit messages to three destinations: a file, STDOUT, and STDERR. |
protected Logger.LogPrintStream |
oLog
Underlying LogPrintStream for messages and files. |
protected java.lang.String |
strFilename
Redirection filename. |
protected java.lang.String |
strLogMessage
Log message to log. |
Fields inherited from class marf.util.BaseThread |
---|
iTID, oTarget, siNextTID |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Logger(java.lang.String pstrFilename)
Takes the log filename and sets the direction to log to the file, STDERR, and STDOUT. |
|
Logger(java.lang.String pstrFilename,
int piLogDirection)
Creates a logger with output filename and desired direction. |
|
Logger(java.lang.String pstrFilename,
int piLogDirection,
boolean pbTimestampRequired)
Creates a logger with output filename, desired direction, and possibly a timestamp. |
Method Summary | |
---|---|
void |
enableTimestamp(boolean pbEnable)
Enables or disables timestamps. |
int |
getLogDirection()
|
java.lang.String |
getLogFilename()
|
Logger.LogPrintStream |
getLogPrintStream()
Returns references to the internal log stream. |
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
boolean |
isTimestampEnabled()
Verifies if the timestamps are enabled. |
void |
setLogDirection(int piLogDirection)
Sets new log direction. |
void |
setLogFilename(java.lang.String pstrFilename)
|
void |
setLogPrintStream(Logger.LogPrintStream poLogPrintStream)
Allows to set new log stream. |
Methods inherited from class marf.util.BaseThread |
---|
getNextTID, getTarget, getTID |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int LOG_TO_FILE_STDOUT_STDERR
public static final int LOG_STDOUT_TO_FILE
public static final int LOG_STDERR_TO_FILE
public static final int LOG_STDOUT_STDERR_TO_FILE
protected boolean bNoTimestamp
true
, no timestamp is issued with a message.
protected java.lang.String strFilename
protected boolean bAvailable
protected Logger.LogPrintStream oLog
protected java.lang.String strLogMessage
protected int iLogDirection
LOG_*
constants for possible directions.
LOG_TO_FILE_STDOUT_STDERR
,
LOG_STDOUT_TO_FILE
,
LOG_STDERR_TO_FILE
,
LOG_STDOUT_STDERR_TO_FILE
Constructor Detail |
---|
public Logger(java.lang.String pstrFilename) throws java.lang.Exception
pstrFilename
- desired log filename
java.lang.Exception
public Logger(java.lang.String pstrFilename, int piLogDirection) throws java.lang.Exception
pstrFilename
- desired log filenamepiLogDirection
- desired logging direction
java.lang.Exception
LOG_TO_FILE_STDOUT_STDERR
,
LOG_STDOUT_TO_FILE
,
LOG_STDERR_TO_FILE
,
LOG_STDOUT_STDERR_TO_FILE
public Logger(java.lang.String pstrFilename, int piLogDirection, boolean pbTimestampRequired) throws java.lang.Exception
pstrFilename
- desired log filenamepiLogDirection
- desired logging directionpbTimestampRequired
- true
if a timestamp desired in logs
java.lang.Exception
LOG_TO_FILE_STDOUT_STDERR
,
LOG_STDOUT_TO_FILE
,
LOG_STDERR_TO_FILE
,
LOG_STDOUT_STDERR_TO_FILE
Method Detail |
---|
public boolean isTimestampEnabled()
public void enableTimestamp(boolean pbEnable)
pbEnable
- true
to enable timestampingpublic int getLogDirection()
public void setLogDirection(int piLogDirection)
piLogDirection
- The iLogDirection to set.
java.lang.IllegalArgumentException
- if the direction parameter is out of rangepublic Logger.LogPrintStream getLogPrintStream()
public void setLogPrintStream(Logger.LogPrintStream poLogPrintStream)
poLogPrintStream
- the new stream to set.public java.lang.String getLogFilename()
public void setLogFilename(java.lang.String pstrFilename)
pstrFilename
- the log filename to set.public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |