Skip to content

Spring Configuration

niclange edited this page Sep 17, 2013 · 1 revision

Create beans perfLogger

Instantiate a bean for each tiers to log Example with two tiers: <!-- BEAN PERF LOG --> <bean id="myLoggerService" class="org.log4perf.PerfLogger"> <property name="logTag" value="service"/> </bean> <bean id="myLoggerDao" class="org.log4perf.PerfLogger"> <property name="logTag" value="dao"/> </bean>

AOP configuration

AOP allows to associate a bean PerfLogger to classes and methods. Example with to tiers: <aop:config> <aop:pointcut id="servicePointcut" expression="execution(* com.compagny.project.service.IServiceOperation.*(..))"/> <aop:aspect id="loggingServiceAspect" ref="myLoggerService"> <aop:around pointcut-ref="servicePointcut" method="logAround"/> </aop:aspect> </aop:config> <aop:config> <aop:pointcut id="daoPointcut" expression="execution(* com.compagny.project.dao.IDaoOperation.*(..))"/> <aop:aspect id="loggingDaoAspect" ref="myLoggerDao"> <aop:around pointcut-ref="daoPointcut" method="logAround"/> </aop:aspect> </aop:config>

Clone this wiki locally