Class ProcessLogger
- Version:
- 2.4
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAppend an informational message to a process trace.static voidcountBegin(String name) Mark the start of a new countable operation on all active process traces.static voidcountBegin(String traceName, String name) Mark the start of a new countable operation on an active process trace.static voidMark the end of a countable operation previously reported viacountBegin(String).static voidMark the end of a countable operation previously reported viacountBegin(String, String).static <T> TFollow a callable process.static <T> TFollow a callable process using the system default verbose setting.static StringintervalToString(long millis) Print a human readable time duration.static booleanDetermine if any process traces are active on the current thread.static booleanisTraceActive(String name) Determine if a process trace is active on the current thread.static booleanDetermine if the named process is active on the current thread with the verbose flag set to true.static StringmemoryToString(long free, long tot, long max) Get a human readable representation of the system memory.static longCount instances of a typically fast operation that may become expensive given a high number of executions.static longCount instances of a typically fast operation that may become expensive given a high number of executions.static longCount instances of a typically fast operation that may become expensive given a high number of executions.static longCount instances of a typically fast operation that may become expensive given a high number of executions.static <T> TsafeFollow(String name, String processDescription, Boolean verbose, Callable<T> callableProcess) Follow a callable process with checked exception handling.static <T> TsafeFollow(String name, String processDescription, Callable<T> callableProcess) Follow a callable process using the system default verbose setting and checked exception handling.static voidsetVerbose(String name, boolean verbose) Modify the verbose flag on a process trace active on the current thread.static StringsizeToString(long bytes) Print a human readable size.static voidReport a trace message on all process traces active on the current thread.static voidReport a trace message on a process trace, if active on the current thread.
-
Constructor Details
-
ProcessLogger
public ProcessLogger()
-
-
Method Details
-
intervalToString
Print a human readable time duration.- Parameters:
millis- The number of milliseconds.- Returns:
- A human readable representation of the time interval represented by millis.
-
sizeToString
Print a human readable size.- Parameters:
bytes- The number of bytes.- Returns:
- A human readable representation of the size.
-
memoryToString
Get a human readable representation of the system memory.- Parameters:
free- free heap memory, in bytestot- total heap memory, in bytesmax- maximum total heap memory, in bytes- Returns:
- A human readable representation of the system memory.
-
safeFollow
Follow a callable process using the system default verbose setting and checked exception handling.- Type Parameters:
T- callable return type- Parameters:
name- The name of the process.processDescription- A message describing the process to report at the top of the trace.callableProcess- The callable process.- Returns:
- The result of calling the process.
- Throws:
IllegalStateException- If checked exception occurs within the callable process.
-
safeFollow
public static <T> T safeFollow(String name, String processDescription, Boolean verbose, Callable<T> callableProcess) Follow a callable process with checked exception handling.- Type Parameters:
T- callable return type- Parameters:
name- The name of the process.processDescription- A message describing the process to report at the top of the trace.verbose- Verbose operation flag, seeProcessLogger.ProcessStatus.verbose.callableProcess- The callable process.- Returns:
- The result of calling the process.
- Throws:
IllegalStateException- If checked exception occurs within the callable process.
-
follow
public static <T> T follow(String name, String processDescription, Callable<T> callableProcess) throws Exception Follow a callable process using the system default verbose setting.- Type Parameters:
T- callable return type- Parameters:
name- The name of the process.processDescription- A message describing the process to report at the top of the trace.callableProcess- The callable process.- Returns:
- The result of calling the process.
- Throws:
Exception- fromCallable.call()
-
follow
public static <T> T follow(String name, String processDescription, Boolean verbose, Callable<T> callableProcess) throws Exception Follow a callable process.- Type Parameters:
T- callable return type- Parameters:
name- The name of the process.processDescription- A message describing the process to report at the top of the trace.verbose- True to note every trace entry, false to only note those that take longer than 1ms.callableProcess- The callable process.- Returns:
- The result of calling the process.
- Throws:
Exception- fromCallable.call()
-
isTraceActive
public static boolean isTraceActive()Determine if any process traces are active on the current thread.- Returns:
- True if any process traces are active on the current thread, false if not.
-
isTraceActive
Determine if a process trace is active on the current thread.- Parameters:
name- The name of the process trace.- Returns:
- True if the named process trace is active on the current thread, false if not.
-
isVerbose
Determine if the named process is active on the current thread with the verbose flag set to true.- Parameters:
name- The name of the process trace.- Returns:
- True if the named process trace is active on the current thread with the verbose flag set to true, false if not.
-
setVerbose
Modify the verbose flag on a process trace active on the current thread.This method has no impact if a process trace with the given name is not active.
- Parameters:
name- The name of the process trace.verbose- The verbose flag setting to apply to the named process trace.
-
trace
Report a trace message on all process traces active on the current thread.The first 40 characters of the message will be printed on the traces along with timing and heap utilization statistics.
When debug logging is enabled, the entire message will be printed via log4j at the DEBUG level.
- Parameters:
message- The message to report on the trace.
-
trace
Report a trace message on a process trace, if active on the current thread.The first 40 characters of the message will be printed on the trace along with timing and heap utilization statistics.
When debug logging is enabled, the entire message will be printed via log4j at the DEBUG level.
- Parameters:
name- The name of the process trace.message- The message to report on the trace.
-
ntrace
Count instances of a typically fast operation that may become expensive given a high number of executions.When the specified number of instances of the same operation have been counted, then a message indicating the execution count will be added to the process trace.
- Parameters:
prefix- The message to report before the count.suffix- The message to report after the count.interval- The number of instances to count between reports on the process trace.- Returns:
- The execution count of the operation on trace with the highest number of executions.
-
ntrace
Count instances of a typically fast operation that may become expensive given a high number of executions.When the specified number of instances of the same operation have been counted, then a message indicating the execution count will be added to the process trace.
- Parameters:
prefix- The message to report before the count.suffix- The message to report after the count.interval- The number of instances to count between reports on the process trace.threshold- The number of instances below which not to report monitored counts.- Returns:
- The execution count of the operation on trace with the highest number of executions.
-
ntrace
Count instances of a typically fast operation that may become expensive given a high number of executions.When the specified number of instances of the same operation have been counted, then a message indicating the execution count will be added to the process trace.
- Parameters:
name- The name of the trace.prefix- The message to report before the count.suffix- The message to report after the count.interval- The number of instances to count between reports on the process trace.- Returns:
- The execution count of the operation on the named trace.
-
ntrace
Count instances of a typically fast operation that may become expensive given a high number of executions.When the specified number of instances of the same operation have been counted, then a message indicating the execution count will be added to the process trace.
- Parameters:
name- The name of the trace.prefix- The message to report before the count.suffix- The message to report after the count.interval- The number of instances to count between reports on the process trace.threshold- The number of instances below which not to report monitored counts.- Returns:
- The execution count of the operation on the named trace.
-
countBegin
Mark the start of a new countable operation on all active process traces.- Parameters:
name- The name of the process counter.
-
countBegin
Mark the start of a new countable operation on an active process trace.- Parameters:
traceName- The name of the process trace.name- The name of the process counter.
-
countEnd
Mark the end of a countable operation previously reported viacountBegin(String).- Parameters:
name- The name of the process counter.detail- Details on the operation that just ended.
-
countEnd
Mark the end of a countable operation previously reported viacountBegin(String, String).- Parameters:
traceName- The name of the process trace.name- The name of the process counter.detail- Details on the operation that just ended.
-
addExtra
Append an informational message to a process trace.The message will additionally be logged at the INFO level.
- Parameters:
traceName- The name of the process trace.message- The information message.
-