67,512
社区成员
发帖
与我相关
我的任务
分享
@Aspect
@Component
public class LogAspect {
public LogAspect() {
}
@Pointcut("execution(* com.example.action..*.*(..))")
public void recordLog(){}
@Before("recordLog()")
public void beforeMethod(JoinPoint jp){
System.out.println("方法:"+jp.getSignature()+"开始执行前");
System.currentTimeMillis();
}
@After("recordLog()")
public void afterMethod(JoinPoint jp){
System.out.println("方法:"+jp.getSignature()+"执行之后");
}
@Around("recordLog()")
public void executeTimeStatics(ProceedingJoinPoint pjp) throws Throwable {
long startTime = System.currentTimeMillis();
pjp.proceed();
long endTime = System.currentTimeMillis();
System.out.println("方法:"+pjp.getSignature()+",处理耗时:"+(endTime-startTime));
}
}
20:23:02.834 [Timer-0] DEBUG org.quartz.utils.UpdateChecker - Checking for available updated version of Quartz...
20:23:05.260 [http-bio-9090-exec-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'entityManagerFactory'
20:23:05.261 [http-bio-9090-exec-1] DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - Opening JPA EntityManager in OpenEntityManagerInViewFilter
20:23:05.297 [http-bio-9090-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'SpringMVCTest' processing GET request for [/mgr/toLogin.do]
20:23:05.298 [http-bio-9090-exec-1] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Looking up handler method for path /toLogin.do
20:23:05.300 [http-bio-9090-exec-1] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Returning handler method [public java.lang.String com.example.action.UserInfoAction.toLogin(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,org.springframework.ui.ModelMap) throws java.lang.Exception]
20:23:05.300 [http-bio-9090-exec-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'userInfoAction'
20:23:05.302 [http-bio-9090-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet - Last-Modified value for [/mgr/toLogin.do] is: -1
20:23:05.352 [http-bio-9090-exec-1] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'logAspect'
方法:String com.example.action.UserInfoAction.toLogin(HttpServletRequest,HttpServletResponse,ModelMap)开始执行前
方法:String com.example.action.UserInfoAction.toLogin(HttpServletRequest,HttpServletResponse,ModelMap),处理耗时:13
方法:String com.example.action.UserInfoAction.toLogin(HttpServletRequest,HttpServletResponse,ModelMap)执行之后
20:23:05.367 [http-bio-9090-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'SpringMVCTest': assuming HandlerAdapter completed request handling
20:23:05.367 [http-bio-9090-exec-1] DEBUG org.springframework.web.servlet.DispatcherServlet - Successfully completed request
20:23:05.371 [http-bio-9090-exec-1] DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - Closing JPA EntityManager in OpenEntityManagerInViewFilter
20:23:05.371 [http-bio-9090-exec-1] DEBUG org.springframework.orm.jpa.EntityManagerFactoryUtils - Closing JPA EntityManager
20:23:28.794 [schedulerFactory_QuartzSchedulerThread] DEBUG org.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers