1. Declare the interceptor (PerformanceMonitorInterceptor) and its pointcut (declaring a pointcut) within the aspect configuration:
Save the below configuration into a config file (aop-config.xml).
2. Include the aop-config.xml file in the spring general configuration file:
3. And enable logging for:
log4j.logger.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=TRACE
The logging has to be to TRACE in order for you to see the following:
Line 22734: 178062 ["http-bio-8079"-exec-2] TRACE org.springframework.aop.interceptor.PerformanceMonitorInterceptor - StopWatch ' com.mypackage.service.ApplicationParametersService.getApplicationParam': running time (millis) = 12
Line 23155: 178551 ["http-bio-8079"-exec-2] TRACE org.springframework.aop.interceptor.PerformanceMonitorInterceptor - StopWatch 'com.mypackage.service.common.PaginatedTableService.getData': running time (millis) = 467
Niciun comentariu:
Trimiteți un comentariu