1
2
3
4
5 package net.sf.crispy.interceptor;
6
7 import net.sf.crispy.Interceptor;
8 import net.sf.crispy.InterceptorContext;
9
10 import org.apache.commons.logging.Log;
11 import org.apache.commons.logging.LogFactory;
12
13 /**
14 * Log every interceptor call with log level "info".
15 *
16 * @author Linke
17 *
18 */
19 public class LogInterceptor implements Interceptor {
20
21 protected static final Log log = LogFactory.getLog (LogInterceptor.class);
22
23 /**
24 * @see net.sf.crispy.Interceptor#beforeNewInstance(java.lang.Class)
25 */
26 public void beforeNewInstance(Class pvInterfaceClass) {
27 log.info("beforeNewInstance: " + pvInterfaceClass);
28 }
29
30 /**
31 * @see net.sf.crispy.Interceptor#afterNewInstance(java.lang.Class, java.lang.Object)
32 */
33 public void afterNewInstance(Class pvInterfaceClass, Object pvProxyObject) {
34 log.info("afterNewInstance: " + pvInterfaceClass + " - " + pvProxyObject);
35 }
36
37 /**
38 * @see net.sf.crispy.Interceptor#beforeMethodInvocation(net.sf.crispy.InterceptorContext)
39 */
40 public void beforeMethodInvocation(InterceptorContext pvInterceptorContext) {
41 log.info("beforeMethodInvocation: " + pvInterceptorContext);
42 }
43
44 /**
45 * @see net.sf.crispy.Interceptor#afterMethodInvocation(net.sf.crispy.InterceptorContext)
46 */
47 public void afterMethodInvocation(InterceptorContext pvInterceptorContext) {
48 log.info("afterMethodInvocation: " + pvInterceptorContext);
49 }
50
51 /**
52 * @see net.sf.crispy.Interceptor#onError(java.lang.Throwable)
53 */
54 public void onError(Throwable pvThrowable) {
55 log.info("onError: " + pvThrowable);
56 }
57
58 }