|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jurvis.logging.JvLoggingUtilities
public final class JvLoggingUtilities
Various utility methods useful in logging.
| Constructor Summary | |
|---|---|
JvLoggingUtilities()
|
|
| Method Summary | |
|---|---|
static void |
debugElapsedTime(org.apache.commons.logging.Log log,
String methodName,
long startTime)
Log the amount of elapsed time consumed by a method. |
static String |
formatElapsedTime(String name,
long startTime)
Format the elapsed time since startTime. |
static void |
infoElapsedTime(org.apache.commons.logging.Log log,
String methodName,
long startTime)
Log the amount of elapsed time consumed by a method. |
static void |
logElapsedTime(org.apache.commons.logging.Log log,
String methodName,
long startTime)
Log the amount of elapsed time consumed by a method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JvLoggingUtilities()
| Method Detail |
|---|
public static String formatElapsedTime(String name,
long startTime)
startTime.
name - the name to reportstartTime - the time in milliseconds when the clock started clicking
public static void logElapsedTime(org.apache.commons.logging.Log log,
String methodName,
long startTime)
long startTime = log.isInfoEnabled() ? System.currentTimeMillis() : 0;
try
{
if (log.isDebugEnabled())
log.debug("testing connection to " + delegate.getServerName());
delegate.testConnection();
}
finally
{
logElapsedTime(log, "testConnection", startTime);
}
log - the log to log tomethodName - the name of the methodstartTime - the time in milliseconds when the method was started
public static void infoElapsedTime(org.apache.commons.logging.Log log,
String methodName,
long startTime)
long startTime = log.isInfoEnabled() ? System.currentTimeMillis() : 0;
try
{
if (log.isDebugEnabled())
log.debug("testing connection to " + delegate.getServerName());
delegate.testConnection();
}
finally
{
infoElapsedTime(log, "testConnection", startTime);
}
log - the log to log tomethodName - the name of the methodstartTime - the time in milliseconds when the method was started
public static void debugElapsedTime(org.apache.commons.logging.Log log,
String methodName,
long startTime)
logElapsedTime in the logging level. Typical usage:
long startTime = log.isDebugEnabled() ? System.currentTimeMillis() : 0;
try
{
if (log.isDebugEnabled())
log.debug("testing connection to " + delegate.getServerName());
delegate.testConnection();
}
finally
{
debugElapsedTime(log, "testConnection", startTime);
}
log - the log to log tomethodName - the name of the methodstartTime - the time in milliseconds when the method was started
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||