Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Spring AOP is preferred over log4j or common-logging?

 
Dattatraya Tembare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why Spring AOP is preferred over log4j or common-logging?

What are the advantages over these two?

I have seen some discussion & found that mix approach can be used... Can anyone elaborate that where & how to handle such situation?


 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring AOP is NOT preferred over log4j or common-logging?
Spring AOP is used in conjunction with and logging framework - log4j, slf4j or commons-logging to separate logging concern from your main business code.

I suggest looking at the spring source provided aspect training - http://www.springsource.com/training/free-online-training-developing-aspects-a
It provides a great overview of AOP & the example used is of logging so you'll get a really good understanding of how to use Spring AOP for logging.
 
Dattatraya Tembare
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! Sam.
 
Kathleen Angeles
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
logging frameworks like log4j are specialized and focused on best logging options and features.

spring aop or any aspect system will be an overkill unless:

1. you need more than logging
2. it is a cross-cutting concern. that means, your custom logging action needs to be applied to many areas or classes in your application.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic