| | |
| | | import org.aspectj.lang.annotation.Around; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | |
| | | @Component |
| | | @Aspect() |
| | | public class LogAspect { |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(LogAspect.class); |
| | | |
| | | private String getMethodName(ProceedingJoinPoint pjp) { |
| | | try { |
| | |
| | | try { |
| | | obj = joinPoint.proceed(args); |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | logger.error("客户端接口访问出错:", e); |
| | | } |
| | | LogHelper.countTime(getMethodName(joinPoint) + "#" + (System.currentTimeMillis() - starttime) + ""); |
| | | return obj; |