Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

Logging Using Spring AOP 2.0 / 3.0

Posted by Pankil Patel on June 9, 2010

How to use Interceptor for logging each method in centralized manner?

Step 1:

Add Three new class for your logging say named ThrowsAdviceInterceptor, MethodBeforeAdviceInterceptor, AfterReturningAdviceInterceptor as like below:

Step 2:

Add entry of these three bean and AOP point cut for logging for Service layer into your applicationContext.xml

as like below:

Here in “aop:config” there is a parameter called:  proxy-target-class=”true”

It is basically responsible for logging methods that are not covered into Services interfaces.

And for this you required cglib.jar

Jar used in this example are:

aspectjweaver-1.6.5.jar
aspectjrt-1.6.5.jar
cglib-2.2.jar
asm-3.1.jar

2 Responses to “Logging Using Spring AOP 2.0 / 3.0”

  1. […] Category Cloud Core Java EMAIL Hibernate Javascript JSF Log Other Performance SMS Spring Struts 2 « Logging Using Spring AOP 2.0 / 3.0 […]

  2. punit said

    good job beta, uploaded very fast.

Leave a reply to Logging Using Spring AOP 1.2 « Enlightensoft's Blog Cancel reply