public class SimpleTraceInterceptor extends AbstractTraceInterceptor
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.
CustomizableTraceInterceptor
,
Serialized FormdefaultLogger
Constructor and Description |
---|
SimpleTraceInterceptor()
Create a new SimpleTraceInterceptor with a static logger.
|
SimpleTraceInterceptor(boolean useDynamicLogger)
Create a new SimpleTraceInterceptor with dynamic or static logger,
according to the given flag.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getInvocationDescription(MethodInvocation invocation)
Return a description for the given method invocation.
|
protected Object |
invokeUnderTrace(MethodInvocation invocation,
Log logger)
Subclasses must override this method to perform any tracing around the
supplied
MethodInvocation . |
getClassForLogging, getLoggerForInvocation, invoke, isInterceptorEnabled, isLogEnabled, setHideProxyClassNames, setLoggerName, setUseDynamicLogger
public SimpleTraceInterceptor()
public SimpleTraceInterceptor(boolean useDynamicLogger)
useDynamicLogger
- whether to use a dynamic logger or a static loggerAbstractTraceInterceptor.setUseDynamicLogger(boolean)
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable
AbstractTraceInterceptor
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.
invokeUnderTrace
in class AbstractTraceInterceptor
logger
- the Log
to write trace messages toMethodInvocation.proceed()
Throwable
- if the call to MethodInvocation.proceed()
encountered any errorsAbstractTraceInterceptor.isInterceptorEnabled(org.aopalliance.intercept.MethodInvocation, org.apache.commons.logging.Log)
,
AbstractTraceInterceptor.isLogEnabled(org.apache.commons.logging.Log)
protected String getInvocationDescription(MethodInvocation invocation)
invocation
- the invocation to describe