Class SimpleTraceInterceptor
java.lang.Object
org.springframework.aop.interceptor.AbstractTraceInterceptor
org.springframework.aop.interceptor.SimpleTraceInterceptor
- All Implemented Interfaces:
- Serializable,- Advice,- Interceptor,- MethodInterceptor
- Direct Known Subclasses:
- DebugInterceptor
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.
- Since:
- 1.2
- Author:
- Dmitriy Kopylenko, Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptordefaultLogger
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new SimpleTraceInterceptor with a static logger.SimpleTraceInterceptor(boolean useDynamicLogger) Create a new SimpleTraceInterceptor with dynamic or static logger, according to the given flag.
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringgetInvocationDescription(MethodInvocation invocation) Return a description for the given method invocation.invokeUnderTrace(MethodInvocation invocation, org.apache.commons.logging.Log logger) Subclasses must override this method to perform any tracing around the suppliedMethodInvocation.Methods inherited from class org.springframework.aop.interceptor.AbstractTraceInterceptorgetClassForLogging, getLoggerForInvocation, invoke, isInterceptorEnabled, isLogEnabled, setHideProxyClassNames, setLogExceptionStackTrace, setLoggerName, setUseDynamicLogger, writeToLog, writeToLog
- 
Constructor Details- 
SimpleTraceInterceptorpublic SimpleTraceInterceptor()Create a new SimpleTraceInterceptor with a static logger.
- 
SimpleTraceInterceptorpublic SimpleTraceInterceptor(boolean useDynamicLogger) Create a new SimpleTraceInterceptor with dynamic or static logger, according to the given flag.- Parameters:
- useDynamicLogger- whether to use a dynamic logger or a static logger
- See Also:
 
 
- 
- 
Method Details- 
invokeUnderTraceprotected @Nullable Object invokeUnderTrace(MethodInvocation invocation, org.apache.commons.logging.Log logger) throws Throwable Description copied from class:AbstractTraceInterceptorSubclasses must override this method to perform any tracing around the suppliedMethodInvocation. Subclasses are responsible for ensuring that theMethodInvocationactually executes by callingMethodInvocation.proceed().By default, the passed-in Loginstance will have log level "trace" enabled. Subclasses do not have to check for this again, unless they overwrite theisInterceptorEnabledmethod to modify the default behavior, and may delegate towriteToLogfor actual messages to be written.- Specified by:
- invokeUnderTracein class- AbstractTraceInterceptor
- Parameters:
- logger- the- Logto write trace messages to
- Returns:
- the result of the call to MethodInvocation.proceed()
- Throws:
- Throwable- if the call to- MethodInvocation.proceed()encountered any errors
- See Also:
 
- 
getInvocationDescriptionReturn a description for the given method invocation.- Parameters:
- invocation- the invocation to describe
- Returns:
- the description
 
 
-