From 9a02204c27a8b917838b02c41c2f311c63dd9d2f Mon Sep 17 00:00:00 2001 From: minuk926 Date: Fri, 13 Jan 2023 18:25:33 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=84=9C=EB=B2=84=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=EB=A1=9C=EA=B7=B8=20=EC=B6=9C=EB=A0=A5=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/framework/core/aop/LogAopAdvice.java | 47 +++++-------------- .../resources/props/dev/globals.properties | 1 + .../resources/props/local/globals.properties | 2 + 3 files changed, 15 insertions(+), 35 deletions(-) diff --git a/src/main/java/kr/xit/framework/core/aop/LogAopAdvice.java b/src/main/java/kr/xit/framework/core/aop/LogAopAdvice.java index b92c6e1f..a7002d94 100644 --- a/src/main/java/kr/xit/framework/core/aop/LogAopAdvice.java +++ b/src/main/java/kr/xit/framework/core/aop/LogAopAdvice.java @@ -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; + - /** - *
-	 * 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.*(..))")
-	 *
- */ - - //@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; diff --git a/src/main/resources/props/dev/globals.properties b/src/main/resources/props/dev/globals.properties index c9825406..95c24f18 100644 --- a/src/main/resources/props/dev/globals.properties +++ b/src/main/resources/props/dev/globals.properties @@ -120,6 +120,7 @@ Globals.Xit.Bbs.useAt = Y # ############################################## # # //XitFramework \uC0AC\uC6A9\uC790 \uCEE4\uC2A4\uD140 \uD56D\uBAA9 # ############################################## # +debug.result.log.trace=false exception.log.trace=true # k byte file.upload.allow.max-size: 2048 diff --git a/src/main/resources/props/local/globals.properties b/src/main/resources/props/local/globals.properties index 57fa9a5b..af81308b 100644 --- a/src/main/resources/props/local/globals.properties +++ b/src/main/resources/props/local/globals.properties @@ -120,7 +120,9 @@ Globals.Xit.Bbs.useAt = Y # ############################################## # # //XitFramework \uC0AC\uC6A9\uC790 \uCEE4\uC2A4\uD140 \uD56D\uBAA9 # ############################################## # +debug.result.log.trace=false exception.log.trace=true + # k byte file.upload.allow.max-size: 2048 file.upload.allow.ext=