open class CustomizableTraceInterceptor : AbstractTraceInterceptor
MethodInterceptor implementation that allows for highly customizable method-level tracing, using placeholders.
Trace messages are written on method entry, and if the method invocation succeeds on method exit. If an invocation results in an exception, then an exception message is written. The contents of these trace messages is fully customizable and special placeholders are available to allow you to include runtime information in your log messages. The placeholders available are:
$[methodName] - replaced with the name of the method being invoked$[targetClassName] - replaced with the name of the class that is the target of the invocation$[targetClassShortName] - replaced with the short name of the class that is the target of the invocation$[returnValue] - replaced with the value returned by the invocation$[argumentTypes] - replaced with a comma-separated list of the short class names of the method arguments$[arguments] - replaced with a comma-separated list of the String representation of the method arguments$[exception] - replaced with the String representation of any Throwable raised during the invocation$[invocationTime] - replaced with the time, in milliseconds, taken by the method invocationThere are restrictions on which placeholders can be used in which messages: see the individual message properties for details on the valid placeholders.
Author
Rob Harrop
Author
Juergen Hoeller
Since
1.2
See Also
#setEnterMessage#setExitMessage#setExceptionMessageSimpleTraceInterceptor
CustomizableTraceInterceptor()
Trace messages are written on method entry, and if the method invocation succeeds on method exit. If an invocation results in an exception, then an exception message is written. The contents of these trace messages is fully customizable and special placeholders are available to allow you to include runtime information in your log messages. The placeholders available are:
There are restrictions on which placeholders can be used in which messages: see the individual message properties for details on the valid placeholders. |
static val PLACEHOLDER_ARGUMENTS: String
The |
|
static val PLACEHOLDER_ARGUMENT_TYPES: String
The |
|
static val PLACEHOLDER_EXCEPTION: String
The |
|
static val PLACEHOLDER_INVOCATION_TIME: String
The |
|
static val PLACEHOLDER_METHOD_NAME: String
The |
|
static val PLACEHOLDER_RETURN_VALUE: String
The |
|
static val PLACEHOLDER_TARGET_CLASS_NAME: String
The |
|
static val PLACEHOLDER_TARGET_CLASS_SHORT_NAME: String
The |
open fun setEnterMessage(enterMessage: String): Unit
Set the template used for method entry log messages. This template can contain any of the following placeholders:
|
|
open fun setExceptionMessage(exceptionMessage: String): Unit
Set the template used for method exception log messages. This template can contain any of the following placeholders:
|
|
open fun setExitMessage(exitMessage: String): Unit
Set the template used for method exit log messages. This template can contain any of the following placeholders:
|
open fun invoke(invocation: MethodInvocation): Any
Determines whether or not logging is enabled for the particular |
|
open fun setHideProxyClassNames(hideProxyClassNames: Boolean): Unit
Set to "true" to have |
|
open fun setLogExceptionStackTrace(logExceptionStackTrace: Boolean): Unit
Set whether to pass an exception to the logger, suggesting inclusion of its stack trace into the log. Default is "true"; set this to "false" in order to reduce the log output to just the trace message (which may include the exception class name and exception message, if applicable). |
|
open fun setLoggerName(loggerName: String): Unit
Set the name of the logger to use. The name will be passed to the underlying logger implementation through Commons Logging, getting interpreted as log category according to the logger's configuration. This can be specified to not log into the category of a class (whether this interceptor's class or the class getting called) but rather into a specific named category. NOTE: Specify either this property or "useDynamicLogger", not both. |
|
open fun setUseDynamicLogger(useDynamicLogger: Boolean): Unit
Set whether to use a dynamic logger or a static logger. Default is a static logger for this trace interceptor. Used to determine which NOTE: Specify either this property or "loggerName", not both. |