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
Advertisements

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: