public class DebugInterceptor extends SimpleTraceInterceptor
MethodInterceptor
that can be introduced in a chain
to display verbose information about intercepted invocations to the logger.
Logs full invocation details on method entry and method exit,
including invocation arguments and invocation count. This is only
intended for debugging purposes; use SimpleTraceInterceptor
or CustomizableTraceInterceptor
for pure tracing purposes.
SimpleTraceInterceptor
,
CustomizableTraceInterceptor
,
Serialized FormModifier and Type | Field and Description |
---|---|
private long |
count |
defaultLogger
Constructor and Description |
---|
DebugInterceptor()
Create a new DebugInterceptor with a static logger.
|
DebugInterceptor(boolean useDynamicLogger)
Create a new DebugInterceptor with dynamic or static logger,
according to the given flag.
|
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Return the number of times this interceptor has been invoked.
|
protected java.lang.String |
getInvocationDescription(MethodInvocation invocation)
Return a description for the given method invocation.
|
java.lang.Object |
invoke(MethodInvocation invocation)
Determines whether or not logging is enabled for the particular
MethodInvocation . |
void |
resetCount()
Reset the invocation count to zero.
|
invokeUnderTrace
getClassForLogging, getLoggerForInvocation, isInterceptorEnabled, isLogEnabled, setHideProxyClassNames, setLoggerName, setUseDynamicLogger
public DebugInterceptor()
public DebugInterceptor(boolean useDynamicLogger)
useDynamicLogger
- whether to use a dynamic logger or a static loggerAbstractTraceInterceptor.setUseDynamicLogger(boolean)
public java.lang.Object invoke(MethodInvocation invocation) throws java.lang.Throwable
AbstractTraceInterceptor
MethodInvocation
.
If not, the method invocation proceeds as normal, otherwise the method invocation is passed
to the invokeUnderTrace
method for handling.invoke
in class AbstractTraceInterceptor
java.lang.Throwable
#invokeUnderTrace(org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log)
protected java.lang.String getInvocationDescription(MethodInvocation invocation)
SimpleTraceInterceptor
getInvocationDescription
in class SimpleTraceInterceptor
invocation
- the invocation to describepublic long getCount()
public void resetCount()