| java.lang.Object org.springframework.aop.interceptor.AbstractTraceInterceptor
All known Subclasses: org.springframework.aop.interceptor.CustomizableTraceInterceptor, org.springframework.aop.interceptor.SimpleTraceInterceptor, org.springframework.aop.interceptor.AbstractMonitoringInterceptor,
Field Summary | |
protected transient Log | defaultLogger The default Log instance used to write trace messages. |
Method Summary | |
protected Log | getLoggerForInvocation(MethodInvocation invocation) Return the appropriate Log instance to use for the given
MethodInvocation . | public Object | invoke(MethodInvocation invocation) Determines whether or not logging is enabled for the particular MethodInvocation . | abstract protected Object | invokeUnderTrace(MethodInvocation invocation, Log logger) Subclasses must override this method to perform any tracing around the
supplied MethodInvocation . | protected boolean | isInterceptorEnabled(MethodInvocation invocation, Log logger) Determine whether the interceptor should kick in, that is,
whether the invokeUnderTrace method should be called.
Default behavior is to check whether the given Log
instance is enabled. | protected boolean | isLogEnabled(Log logger) Determine whether the given
Log instance is enabled. | public void | setHideProxyClassNames(boolean hideProxyClassNames) Set to "true" to have
AbstractTraceInterceptor.setUseDynamicLogger dynamic loggers hide
proxy class names wherever possible. | public void | setLoggerName(String loggerName) Set the name of the logger to use. | public void | setUseDynamicLogger(boolean useDynamicLogger) Set whether to use a dynamic logger or a static logger. |
defaultLogger | protected transient Log defaultLogger(Code) | | The default Log instance used to write trace messages.
This instance is mapped to the implementing Class .
|
getLoggerForInvocation | protected Log getLoggerForInvocation(MethodInvocation invocation)(Code) | | Return the appropriate Log instance to use for the given
MethodInvocation . If the useDynamicLogger flag
is set, the Log instance will be for the target class of the
MethodInvocation , otherwise the Log will be the
default static logger.
Parameters: invocation - the MethodInvocation being traced the Log instance to use See Also: AbstractTraceInterceptor.setUseDynamicLogger |
invokeUnderTrace | abstract protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable(Code) | | 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.
Parameters: logger - the Log to write trace messages to the result of the call to MethodInvocation.proceed() throws: Throwable - if the call to MethodInvocation.proceed() encountered any errors See Also: AbstractTraceInterceptor.isInterceptorEnabled See Also: AbstractTraceInterceptor.isLogEnabled |
isInterceptorEnabled | protected boolean isInterceptorEnabled(MethodInvocation invocation, Log logger)(Code) | | Determine whether the interceptor should kick in, that is,
whether the invokeUnderTrace method should be called.
Default behavior is to check whether the given Log
instance is enabled. Subclasses can override this to apply the
interceptor in other cases as well.
Parameters: invocation - the MethodInvocation being traced Parameters: logger - the Log instance to check See Also: AbstractTraceInterceptor.invokeUnderTrace See Also: AbstractTraceInterceptor.isLogEnabled |
isLogEnabled | protected boolean isLogEnabled(Log logger)(Code) | | Determine whether the given
Log instance is enabled.
Default is true when the "trace" level is enabled.
Subclasses can override this to change the level under which 'tracing' occurs.
Parameters: logger - the Log instance to check |
setLoggerName | public void setLoggerName(String loggerName)(Code) | | Set the name of the logger to use. The name will be passed to the
underlying logger implementation through Commons Logging, getting
interpreted as log category according to the logger's configuration.
This can be specified to not log into the category of a class
(whether this interceptor's class or the class getting called)
but rather into a specific named category.
NOTE: Specify either this property or "useDynamicLogger", not both.
See Also: org.apache.commons.logging.LogFactory.getLog(String) See Also: org.apache.log4j.Logger.getLogger(String) See Also: java.util.logging.Logger.getLogger(String) |
setUseDynamicLogger | public void setUseDynamicLogger(boolean useDynamicLogger)(Code) | | Set whether to use a dynamic logger or a static logger.
Default is a static logger for this trace interceptor.
Used to determine which Log instance should be used to write
log messages for a particular method invocation: a dynamic one for the
Class getting called, or a static one for the Class
of the trace interceptor.
NOTE: Specify either this property or "loggerName", not both.
See Also: AbstractTraceInterceptor.getLoggerForInvocation(org.aopalliance.intercept.MethodInvocation) |
|
|