|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jlf.log.AppInstrument
This class provides a timer utility to instrument your application. When you create a new instance of this class, it starts a timer before returning. Then do some work in your application and when you want to stop the timer and output the result to the log, call the logTime() method.
Log
Field Summary | |
protected long |
alertTimeOutMilliseconds
Holds a time out value in milliseconds. |
protected java.lang.String |
instrumentedEventName
Holds the String which will be output to
the log as a prefix to the time it takes to perform
the actions the instrumented time. |
protected int |
outputAlertLoggingLevel
Holds the alert logging level for the Log when an instrumented event goes beyond its time out value. |
protected Log |
outputLog
Holds the Log you will output the time to. |
protected int |
outputLoggingLevel
Holds the logging level for the Log when writing the log entry out. |
protected long |
startTime
Holds the start time from when the instance was created. |
Constructor Summary | |
protected |
AppInstrument()
Protect the default constructor, use a parameterized constructor below! |
|
AppInstrument(java.lang.String instrumentedEventName)
Constructor which accepts the name of the event you are going to instrument. |
|
AppInstrument(java.lang.String instrumentedEventName,
int loggingLevel)
Constructor which accepts the name of the event you are going to instrument and the logging level you are going to log to. |
|
AppInstrument(java.lang.String instrumentedEventName,
int loggingLevel,
long alertTimeOutMilliseconds)
Constructor which accepts the name of the event you are going to instrument, the normal logging level, and a timeout value that if exceeded changes the logging level to the alert status. |
|
AppInstrument(java.lang.String instrumentedEventName,
Log log)
Constructor which accepts the name of the event you are going to instrument and the log you are going to log to. |
|
AppInstrument(java.lang.String instrumentedEventName,
Log log,
int loggingLevel)
Constructor which accepts the name of the event you are going to instrument and the log you are going to log to, and the logging level. |
|
AppInstrument(java.lang.String instrumentedEventName,
Log log,
int loggingLevel,
int alertLoggingLevel,
long alertTimeOutMilliseconds)
Constructor which accepts all parameters for creating an instrument. |
Method Summary | |
protected static int |
getDefaultAlertLoggingLevel()
Returns the default logging level to log to when writing the output of the instrument. |
protected static long |
getDefaultAlertTimeOutMilliseconds()
Returns the default alert time out value, set to zero, so that an event does not time out and raise its logging level to an error status. |
protected static Log |
getDefaultLog()
Returns the default Log to log to when
writing the output of the instrument. |
protected static int |
getDefaultLoggingLevel()
Returns the default logging level to log to when writing the output of the instrument. |
long |
logTime()
Logs the time since the timer was started to the log and logging level set when the instrument was created. |
long |
logTime(java.lang.String instrumentedEventName)
Logs the time since the timer was started to the log and logging level set when the instrument was created, sets/resets the instrumented event string to the input string. |
void |
resetTimer()
Resets the timer so that you can re-use the same AppInstrument object to time different events. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String instrumentedEventName
String
which will be output to
the log as a prefix to the time it takes to perform
the actions the instrumented time.
protected Log outputLog
Log
you will output the time to.
protected long alertTimeOutMilliseconds
protected int outputLoggingLevel
protected int outputAlertLoggingLevel
protected long startTime
Constructor Detail |
protected AppInstrument()
public AppInstrument(java.lang.String instrumentedEventName)
public AppInstrument(java.lang.String instrumentedEventName, int loggingLevel)
public AppInstrument(java.lang.String instrumentedEventName, Log log)
public AppInstrument(java.lang.String instrumentedEventName, Log log, int loggingLevel)
public AppInstrument(java.lang.String instrumentedEventName, int loggingLevel, long alertTimeOutMilliseconds)
public AppInstrument(java.lang.String instrumentedEventName, Log log, int loggingLevel, int alertLoggingLevel, long alertTimeOutMilliseconds)
Method Detail |
protected static Log getDefaultLog()
Log
to log to when
writing the output of the instrument. The default for
this class is AppLog
.
protected static int getDefaultLoggingLevel()
protected static int getDefaultAlertLoggingLevel()
protected static long getDefaultAlertTimeOutMilliseconds()
public long logTime()
public long logTime(java.lang.String instrumentedEventName)
public void resetTimer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |