Class LoggingInterceptorServiceImpl
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
org.apache.fulcrum.yaafi.interceptor.logging.LoggingInterceptorServiceImpl
- All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable,org.apache.avalon.framework.configuration.Configurable,org.apache.avalon.framework.configuration.Reconfigurable,org.apache.avalon.framework.context.Contextualizable,org.apache.avalon.framework.logger.LogEnabled,AvalonInterceptorService,LoggingInterceptorService
public class LoggingInterceptorServiceImpl
extends BaseInterceptorServiceImpl
implements LoggingInterceptorService, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.activity.Initializable
A service logging of service invocations. The service allows to monitor a
list of services defined in the configuration.
- Author:
- Siegfried Goeschl
-
Field Summary
Fields inherited from interface org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService
ON_ENTRY, ON_ERROR, ON_EXIT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.apache.avalon.framework.configuration.Configuration configuration) protected InterceptorToStringBuildercreateArgumentToStringBuilder(Object target) Create an instance of an InterceptorToStringBuilderprotected voidcreateStopWatch(AvalonInterceptorContext interceptorContext) Creates a stop watchprotected intprotected StopWatchgetStopWatch(AvalonInterceptorContext interceptorContext) Gets the stop watch.protected Class<?> protected Stringvoidprotected booleanvoidonEntry(AvalonInterceptorContext interceptorContext) Called before a service method is invoked.voidonError(AvalonInterceptorContext interceptorContext, Throwable t) Called when a service method throws an exeptionvoidonExit(AvalonInterceptorContext interceptorContext, Object result) Called after a service method was invoked.voidreconfigure(org.apache.avalon.framework.configuration.Configuration configuration) protected StringtoString(AvalonInterceptorContext interceptorContext, StopWatch stopWatch, int mode) Create a method signature.protected StringtoString(AvalonInterceptorContext avalonInterceptorContext, StopWatch stopWatch, Object result) Create a string representation of a service invocation returning a result.protected StringtoString(AvalonInterceptorContext avalonInterceptorContext, StopWatch stopWatch, Throwable throwable) Create a string representation of a service invocation throwing a ThrowableMethods inherited from class org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl
contextualize, getClassLoader, getServiceApplicationDir, getServiceManager, getServiceName, getServiceTempDir, isEnabled, isServiceMonitored, makeAbsoluteFileMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
LoggingInterceptorServiceImpl
public LoggingInterceptorServiceImpl()Constructor
-
-
Method Details
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
configurein interfaceorg.apache.avalon.framework.configuration.Configurable- Overrides:
configurein classBaseInterceptorServiceImpl- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- See Also:
-
initialize
- Specified by:
initializein interfaceorg.apache.avalon.framework.activity.Initializable- Throws:
Exception- See Also:
-
reconfigure
public void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
reconfigurein interfaceorg.apache.avalon.framework.configuration.Reconfigurable- Overrides:
reconfigurein classBaseInterceptorServiceImpl- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- See Also:
-
onEntry
Description copied from interface:AvalonInterceptorServiceCalled before a service method is invoked.- Specified by:
onEntryin interfaceAvalonInterceptorService- Overrides:
onEntryin classBaseInterceptorServiceImpl- Parameters:
interceptorContext- shared interceptor context- See Also:
-
onError
Description copied from interface:AvalonInterceptorServiceCalled when a service method throws an exeption- Specified by:
onErrorin interfaceAvalonInterceptorService- Overrides:
onErrorin classBaseInterceptorServiceImpl- Parameters:
interceptorContext- shared interceptor contextt- the resulting exception- See Also:
-
onExit
Description copied from interface:AvalonInterceptorServiceCalled after a service method was invoked.- Specified by:
onExitin interfaceAvalonInterceptorService- Overrides:
onExitin classBaseInterceptorServiceImpl- Parameters:
interceptorContext- shared interceptor contextresult- the result of the invocation- See Also:
-
createStopWatch
Creates a stop watch- Parameters:
interceptorContext- the current interceptor context
-
getStopWatch
Gets the stop watch. Even if none is defined we return one in a proper state.- Parameters:
interceptorContext- the current interceptor context- Returns:
- the stop watch
-
getMaxArgLength
protected int getMaxArgLength()- Returns:
- Returns the maxLineLength.
-
isMonitorAllExceptions
protected boolean isMonitorAllExceptions()- Returns:
- Returns the monitorAllExceptions.
-
getToStringBuilderClass
- Returns:
- Returns the toStringBuilderClass.
-
getToStringBuilderClassName
- Returns:
- Returns the toStringBuilderClassName.
-
createArgumentToStringBuilder
Create an instance of an InterceptorToStringBuilder- Parameters:
target- the object to stringify- Returns:
- the string builder
-
toString
protected String toString(AvalonInterceptorContext avalonInterceptorContext, StopWatch stopWatch, Object result) Create a string representation of a service invocation returning a result.- Parameters:
avalonInterceptorContext- the interceptor contextstopWatch- the stopwatch for the execution timeresult- the result of the service invocation- Returns:
- the string representation of the result
-
toString
protected String toString(AvalonInterceptorContext avalonInterceptorContext, StopWatch stopWatch, Throwable throwable) Create a string representation of a service invocation throwing a Throwable- Parameters:
avalonInterceptorContext- the interceptor contextstopWatch- the stopwatch for the execution timethrowable- the result of the service invocation- Returns:
- the string representation of the result
-
toString
protected String toString(AvalonInterceptorContext interceptorContext, StopWatch stopWatch, int mode) Create a method signature.- Parameters:
interceptorContext- the avalonInterceptorContextstopWatch- the stopwatch for the execution timemode- the mode (onEntry, onExit, onError)- Returns:
- the debug output
-