|
|
|
@ -12,6 +12,7 @@ import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
|
|
import org.aspectj.lang.annotation.AfterThrowing;
|
|
|
|
|
import org.aspectj.lang.annotation.Around;
|
|
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
|
import org.springframework.web.context.request.RequestAttributes;
|
|
|
|
@ -19,40 +20,21 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import kr.xit.framework.support.mybatis.PagingConstants;
|
|
|
|
|
import kr.xit.framework.support.mybatis.paging.domain.Paginator;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Component
|
|
|
|
|
@Aspect
|
|
|
|
|
public class LogAopAdvice {
|
|
|
|
|
@Value("#{prop['debug.result.log.trace']}")
|
|
|
|
|
private boolean isRsltLog;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <pre>
|
|
|
|
|
* AOP 설정 before Advice : JoinPoint (JointPoint는 Arround 방식에선 사용 불가)
|
|
|
|
|
* after-returning Advice : JoinPoint, Object around Advice :
|
|
|
|
|
* ProceedingJoinPoint - MethodInterceptor와 동일 <aop:config> <aop:config>
|
|
|
|
|
* <aop:aspect id="aroundProceed" ref="huimaiAopdvice"> <aop:pointcut id="pointCut"
|
|
|
|
|
* expression="execution(* com.huimai.biz.*.controller.*.*(..))"/>
|
|
|
|
|
* <aop:around method="aroundProceed" pointcut-ref="pointCut"/>
|
|
|
|
|
* </aop:aspect> <aop:aspect id="afterProceed" ref="huimaiAopdvice">
|
|
|
|
|
* <aop:pointcut id="pointCut"
|
|
|
|
|
* expression="execution(* com.huimai.biz.*.controller.*.*(..))"/>
|
|
|
|
|
* <aop:after-returning method="afterProceed" pointcut-ref="pointCut"
|
|
|
|
|
* returning="ret"/> </aop:aspect> <aop:aspect id="beforeProceed"
|
|
|
|
|
* ref="huimaiAopdvice"> <aop:pointcut id="pointCut"
|
|
|
|
|
* expression="execution(* com.huimai.biz.*.controller.*.*(..))"/>
|
|
|
|
|
* <aop:before method="beforeProceed" pointcut-ref="pointCut"/>
|
|
|
|
|
* </aop:aspect> </aop:config>
|
|
|
|
|
* ("execution(public * com.sjf..controller.*.*(..))") : com.sjf 하단 controller class의 모든 메소드
|
|
|
|
|
* --> 오류 주의 ("execution(public * com.sjf..controller.*(..))")
|
|
|
|
|
*</pre>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//@Around("execution((public * project..controller.*.*(..))||execution(public * framework..controller.*.*(..))) && !@annotation(com.tistory.eisen.annotation.SkipChecking)")
|
|
|
|
|
@Around("execution(public * kr.xit.framework..web.*.*(..))||execution(public * kr.xit.fims..web.*.*(..))")
|
|
|
|
|
public Object aroundProceed(ProceedingJoinPoint pjp) throws Throwable {
|
|
|
|
|
|
|
|
|
|
String methodName = pjp.getSignature().getName();
|
|
|
|
|
// StopWatch sw = new StopWatch(pjp.toShortString());//
|
|
|
|
|
// sw.start(methodName);
|
|
|
|
@ -63,21 +45,16 @@ public class LogAopAdvice {
|
|
|
|
|
HttpServletRequest request = servletRequestAttributes.getRequest();
|
|
|
|
|
requestLog(request);
|
|
|
|
|
Object[] args = pjp.getArgs();
|
|
|
|
|
//if (args.length > 0){
|
|
|
|
|
// log.info("//==============================Parameters====================================");
|
|
|
|
|
// log.debug("Http Request Parameters = {}", args[0]);
|
|
|
|
|
// log.info("=========================================================================//");
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//TODO 필요시 insert log
|
|
|
|
|
//logInsert(methodName, request, paraMap+"");
|
|
|
|
|
|
|
|
|
|
Object rtnObj = pjp.proceed();
|
|
|
|
|
// Object rtnObj = pjp.proceed(args);
|
|
|
|
|
log.info("//==============================Result====================================");
|
|
|
|
|
log.info("{}", rtnObj);
|
|
|
|
|
log.info("=========================================================================//");
|
|
|
|
|
|
|
|
|
|
if(isRsltLog) {
|
|
|
|
|
log.info("//==============================Result====================================");
|
|
|
|
|
log.info("{}", rtnObj);
|
|
|
|
|
log.info("=========================================================================//");
|
|
|
|
|
}
|
|
|
|
|
Object pageObject = RequestContextHolder.getRequestAttributes().getAttribute(PagingConstants.Session.PAGE_INFO.getCode(), RequestAttributes.SCOPE_REQUEST);
|
|
|
|
|
if(pageObject != null && rtnObj != null){
|
|
|
|
|
Paginator paginator = (Paginator)pageObject;
|
|
|
|
|