|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectpatterntesting.runtime.log.PerfLogger
public final class PerfLogger
This class is a kind of performance logger to be able to log the execution times of methods or code segments which may need a little bit longer. It can be used as a replacement of a normal logger.
We use a LogWatch to measure the times between a
start(String, Object...) and end(String, Object...) call.
We store this LogWatch as ThreadLocal because loggers are
normally used as static variables. So we can be sure that each thread has
its own LogWatch.
| Constructor Summary | |
|---|---|
PerfLogger()
Instantiates a new perf logger. |
|
PerfLogger(Class<?> clazz)
Instantiates a new perf logger. |
|
PerfLogger(org.slf4j.Logger logger)
Instantiates a new perf logger. |
|
| Method Summary | |
|---|---|
void |
debug(String format,
Object... args)
Debug. |
void |
end(int level,
String format,
Object... args)
End the log with the given message. |
void |
end(String format,
Object... args)
End the log with the given message. |
void |
error(String format,
Object... args)
Error. |
void |
info(String format,
Object... args)
Info. |
boolean |
isDebugEnabled()
Checks if is debug enabled. |
void |
log(int level,
String format,
Object... args)
Log. |
void |
start(int level,
String format,
Object... args)
Start the log for the given message. |
void |
start(String format,
Object... args)
Start the log for the given message. |
void |
stop(ProfileMonitor mon,
String command)
Deprecated. moved to SqlStatistic class |
void |
stop(ProfileMonitor mon,
String command,
Object returnValue)
Deprecated. moved to SqlStatistic class |
void |
trace(String format,
Object... args)
Trace. |
void |
warn(String format,
Object... args)
Warn. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PerfLogger()
public PerfLogger(Class<?> clazz)
clazz - the clazzpublic PerfLogger(org.slf4j.Logger logger)
logger - the logger| Method Detail |
|---|
public void start(String format,
Object... args)
format - the formatargs - the args
public void start(int level,
String format,
Object... args)
level - the levelformat - the formatargs - the args
SimpleLog.SimpleLog
public void end(String format,
Object... args)
start(String, Object...) log. So be sure to
call one of the start methods before.
The default level for the logged message is "INFO".
format - the formatargs - the args
public void end(int level,
String format,
Object... args)
start(String, Object...) log. So be sure to
call one of the start methods before.
It is recommended to use the same as in
level - the levelformat - the formatargs - the args
start(int, String, Object...). If the reported times is greater
than 1 minute the log level will be increased at least to "INFO".
public void log(int level,
String format,
Object... args)
level - the levelformat - the formatargs - the args
public void error(String format,
Object... args)
format - the formatargs - the args
public void warn(String format,
Object... args)
format - the formatargs - the args
public void info(String format,
Object... args)
format - the formatargs - the args
public void debug(String format,
Object... args)
format - the formatargs - the args
@Deprecated
public void stop(ProfileMonitor mon,
String command)
mon - the moncommand - the command
@Deprecated
public void stop(ProfileMonitor mon,
String command,
Object returnValue)
mon - the moncommand - the commandreturnValue - the return value
public void trace(String format,
Object... args)
format - the formatargs - the argspublic boolean isDebugEnabled()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||