Top Description Fields Constructors Methods
org.springframework.aop.interceptor

public Class DebugInterceptor

extends SimpleTraceInterceptor
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
org.aopalliance.intercept.MethodInvocation, org.springframework.lang.Nullable

AOP Alliance 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.

Authors
Rod Johnson, Juergen Hoeller
See Also
SimpleTraceInterceptor, CustomizableTraceInterceptor

Field Summary

Modifier and TypeField and Description
private volatile long

Constructor Summary

AccessConstructor and Description
public
DebugInterceptor()

Create a new DebugInterceptor with a static logger.

public
DebugInterceptor(boolean
whether to use a dynamic logger or a static logger
useDynamicLogger
)

Create a new DebugInterceptor with dynamic or static logger, according to the given flag.

Method Summary

Modifier and TypeMethod and Description
public long
getCount()

Return the number of times this interceptor has been invoked.

protected String
getInvocationDescription(MethodInvocation
the invocation to describe
invocation
)

Overrides org.springframework.aop.interceptor.SimpleTraceInterceptor.getInvocationDescription.

Return a description for the given method invocation.

public Object
invoke(MethodInvocation
the method invocation joinpoint
invocation
)

Overrides org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke.

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Determines whether logging is enabled for the particular MethodInvocation.

public synchronized void
resetCount()

Reset the invocation count to zero.

Inherited from org.springframework.aop.interceptor.SimpleTraceInterceptor:
invokeUnderTrace

Field Detail

countback to summary
private volatile long count

Constructor Detail

DebugInterceptorback to summary
public DebugInterceptor()

Create a new DebugInterceptor with a static logger.

DebugInterceptorback to summary
public DebugInterceptor(boolean useDynamicLogger)

Create a new DebugInterceptor with dynamic or static logger, according to the given flag.

Parameters
useDynamicLogger:boolean

whether to use a dynamic logger or a static logger

See Also
setUseDynamicLogger

Method Detail

getCountback to summary
public long getCount()

Return the number of times this interceptor has been invoked.

getInvocationDescriptionback to summary
protected String getInvocationDescription(MethodInvocation invocation)

Overrides org.springframework.aop.interceptor.SimpleTraceInterceptor.getInvocationDescription.

Doc from org.springframework.aop.interceptor.SimpleTraceInterceptor.getInvocationDescription.

Return a description for the given method invocation.

Parameters
invocation:MethodInvocation

the invocation to describe

Returns:String

the description

Annotations
@Override
invokeback to summary
public Object invoke(MethodInvocation invocation) throws Throwable

Overrides org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke.

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Doc from org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke.

Determines whether logging is enabled for the particular MethodInvocation. If not, the method invocation proceeds as normal, otherwise the method invocation is passed to the invokeUnderTrace method for handling.

Parameters
invocation:MethodInvocation

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

the method invocation joinpoint

Returns:Object

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

the result of the call to Joinpoint#proceed(); might be intercepted by the interceptor

Annotations
@Override
@Nullable
Exceptions
Throwable:

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

if the interceptors or the target object throws an exception

resetCountback to summary
public synchronized void resetCount()

Reset the invocation count to zero.