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

public Class SimpleTraceInterceptor

extends AbstractTraceInterceptor
Class Inheritance
Known Direct Subclasses
org.springframework.aop.interceptor.DebugInterceptor
Annotations
@SuppressWarnings:serial
Imports
org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log, org.springframework.util.Assert

Simple AOP Alliance MethodInterceptor that can be introduced in a chain to display verbose trace information about intercepted method invocations, with method entry and method exit info.

Consider using CustomizableTraceInterceptor for more advanced needs.

Authors
Dmitriy Kopylenko, Juergen Hoeller
Since
1.2
See Also
CustomizableTraceInterceptor

Field Summary

Inherited from org.springframework.aop.interceptor.AbstractTraceInterceptor:
defaultLogger

Constructor Summary

AccessConstructor and Description
public
SimpleTraceInterceptor()

Create a new SimpleTraceInterceptor with a static logger.

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

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

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

the description
getInvocationDescription
(MethodInvocation
the invocation to describe
invocation
)

Return a description for the given method invocation.

protected Object
invokeUnderTrace(MethodInvocation invocation, Log
the Log to write trace messages to
logger
)

Implements abstract org.springframework.aop.interceptor.AbstractTraceInterceptor.invokeUnderTrace.

Subclasses must override this method to perform any tracing around the supplied MethodInvocation.

Inherited from org.springframework.aop.interceptor.AbstractTraceInterceptor:
getClassForLogginggetLoggerForInvocationinvokeisInterceptorEnabledisLogEnabledsetHideProxyClassNamessetLogExceptionStackTracesetLoggerNamesetUseDynamicLoggerwriteToLogwriteToLog

Constructor Detail

SimpleTraceInterceptorback to summary
public SimpleTraceInterceptor()

Create a new SimpleTraceInterceptor with a static logger.

SimpleTraceInterceptorback to summary
public SimpleTraceInterceptor(boolean useDynamicLogger)

Create a new SimpleTraceInterceptor 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

getInvocationDescriptionback to summary
protected String getInvocationDescription(MethodInvocation invocation)

Return a description for the given method invocation.

Parameters
invocation:MethodInvocation

the invocation to describe

Returns:String

the description

invokeUnderTraceback to summary
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable

Implements abstract org.springframework.aop.interceptor.AbstractTraceInterceptor.invokeUnderTrace.

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

Subclasses must override this method to perform any tracing around the supplied MethodInvocation. Subclasses are responsible for ensuring that the MethodInvocation actually executes by calling MethodInvocation.proceed().

By default, the passed-in Log instance will have log level "trace" enabled. Subclasses do not have to check for this again, unless they overwrite the isInterceptorEnabled method to modify the default behavior, and may delegate to writeToLog for actual messages to be written.

Parameters
logger:Log

the Log to write trace messages to

Returns:Object

the result of the call to MethodInvocation.proceed()

Annotations
@Override
Exceptions
Throwable:
if the call to MethodInvocation.proceed() encountered any errors