|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.MemoryInfoLogger
public class MemoryInfoLogger
Class MemoryInfoLogger defines a debugging utility that generates periodic log messages showing information about memory usage in a program. The messages are in the form "Memory info: total=#, free=#, diff=#", with each value in bytes. A new thread is created to generate the log messages.
Nested Class Summary | |
---|---|
protected class |
MemoryInfoLogger.LoggerRunningThread
Class LoggerRunningThread defines a separate thread used to build and output the log file entries. |
Field Summary | |
---|---|
protected java.io.PrintStream |
altOutputStream
|
protected boolean |
closeOnTerminateFlag
|
protected int |
intervalSeconds
|
protected MemoryInfoLogger.LoggerRunningThread |
loggerRunningThreadObj
|
protected int |
logLevelVal
|
protected LogFile |
logObj
|
protected java.lang.StringBuffer |
stringBufferObj
|
Constructor Summary | |
---|---|
MemoryInfoLogger(LogFile logObj,
int intervalSeconds)
Creates a memory information logger object and starts a new log-message-generation thread. |
|
MemoryInfoLogger(java.io.PrintStream stmObj,
int intervalSeconds)
Creates a memory information logger object and starts a new message-generation thread. |
|
MemoryInfoLogger(java.lang.String logFileName,
int intervalSeconds)
Creates a memory information logger object and starts a new log-message-generation thread. |
|
MemoryInfoLogger(java.lang.String logFileName,
int intervalSeconds,
boolean useDateInFnameFlag)
Creates a memory information logger object and starts a new log-message-generation thread. |
|
MemoryInfoLogger(java.lang.String logFileName,
int intervalSeconds,
int maxLogFileAgeDays)
Creates a memory information logger object and starts a new log-message-generation thread. |
|
MemoryInfoLogger(java.lang.String logFileName,
int intervalSeconds,
int maxLogFileAgeDays,
int logFileSwitchIntervalDays)
Creates a memory information logger object and starts a new log-message-generation thread. |
Method Summary | |
---|---|
protected void |
logOutputStr(java.lang.String msgStr)
Sends the given message to the output log file or stream. |
void |
setCloseLogOnTerminateFlag(boolean flgVal)
Sets whether or not the log file is closed when the logging thread terminates. |
void |
setConsoleOutputFlag(boolean flgVal)
Sets the flag to enable console output of log messages. |
void |
setLogLevelVal(int levelVal)
Sets the log-level value to be used. |
protected void |
startLoggerThread(int intervalSeconds)
Starts the memory-information-logging thread. |
void |
terminate()
Terminates the logging thread created by this MemoryInfoLogger. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final LogFile logObj
protected final java.io.PrintStream altOutputStream
protected int intervalSeconds
protected java.lang.StringBuffer stringBufferObj
protected MemoryInfoLogger.LoggerRunningThread loggerRunningThreadObj
protected int logLevelVal
protected boolean closeOnTerminateFlag
Constructor Detail |
---|
public MemoryInfoLogger(LogFile logObj, int intervalSeconds)
logObj
- the LogFile object to use for output.intervalSeconds
- the number of seconds between log outputs.public MemoryInfoLogger(java.lang.String logFileName, int intervalSeconds)
logFileName
- the name of the log file to be created and used
for output.intervalSeconds
- the number of seconds between log outputs.public MemoryInfoLogger(java.lang.String logFileName, int intervalSeconds, boolean useDateInFnameFlag)
logFileName
- the name of the log file to be created and used
for output.intervalSeconds
- the number of seconds between log outputs.useDateInFnameFlag
- true to use the date in the file name (and
create a new log file every time the date changes).public MemoryInfoLogger(java.lang.String logFileName, int intervalSeconds, int maxLogFileAgeDays)
logFileName
- the name of the log file to be created and used
for output.intervalSeconds
- the number of seconds between log outputs.maxLogFileAgeDays
- the maximum log file age, in days.public MemoryInfoLogger(java.lang.String logFileName, int intervalSeconds, int maxLogFileAgeDays, int logFileSwitchIntervalDays)
logFileName
- the name of the log file to be created and used
for output.intervalSeconds
- the number of seconds between log outputs.maxLogFileAgeDays
- the maximum log file age, in days.logFileSwitchIntervalDays
- the minimum number of days between
log file switches via date changes.public MemoryInfoLogger(java.io.PrintStream stmObj, int intervalSeconds)
stmObj
- the stream object to use for output.intervalSeconds
- the number of seconds between log outputs.Method Detail |
---|
protected void startLoggerThread(int intervalSeconds)
intervalSeconds
- the number of seconds between log outputs.public void setConsoleOutputFlag(boolean flgVal)
flgVal
- true to enable console output, false to disable.public void setLogLevelVal(int levelVal)
levelVal
- the log-level value to be used.public void setCloseLogOnTerminateFlag(boolean flgVal)
flgVal
- true to close the log file on terminate, false to not.public void terminate()
protected void logOutputStr(java.lang.String msgStr)
msgStr
- the message string to send.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |