|
@@ -1,96 +0,0 @@
|
|
|
-package com.utic.incident.common.annotation;
|
|
|
-
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-
|
|
|
-@Slf4j
|
|
|
-//@Aspect
|
|
|
-//@Component
|
|
|
-public class LoggingAspect {
|
|
|
-// public enum ProcessType {
|
|
|
-// JOB_5MIN,
|
|
|
-// DATA_PROCESSING,
|
|
|
-// LOGGING
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Retention(RetentionPolicy.RUNTIME)
|
|
|
-// @Target(ElementType.METHOD)
|
|
|
-// public @interface ProcessingElapsed {
|
|
|
-// ProcessType[] value();
|
|
|
-// }
|
|
|
-
|
|
|
-// @Retention(RetentionPolicy.RUNTIME)
|
|
|
-// @Target(ElementType.METHOD)
|
|
|
-// public @interface ProcessingElapsed {
|
|
|
-// String[] value();
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-// private void logElapsedStart(String processName) {
|
|
|
-// log.info("[05MIN...] ..... {}: [{}]", LogUtils.elapsedLog(processName + " 시작"), TimeUtils.getCurrentTimeString());
|
|
|
-// }
|
|
|
-// private void logElapsedTime(String processName, Elapsed elapsed) {
|
|
|
-// log.info("[05MIN...] ..... {}", LogUtils.elapsedLog(processName + " 종료", elapsed.milliSeconds()));
|
|
|
-// }
|
|
|
-
|
|
|
-// @Around("@annotation(ProcessingElapsed)")
|
|
|
-// public Object processingElapsedTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
|
|
-// MethodSignature signature = (MethodSignature)joinPoint.getSignature();
|
|
|
-// ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
|
|
|
-// String processName = annotation != null ? annotation.value() : "UNKNOWN_PROCESS";
|
|
|
-//
|
|
|
-// long start = System.currentTimeMillis();
|
|
|
-// Object proceed = joinPoint.proceed();
|
|
|
-// long executionTime = System.currentTimeMillis() - start;
|
|
|
-//
|
|
|
-// log.info("[05MIN...] {} 종료, 실행 시간: {} ms", processName, executionTime);
|
|
|
-//
|
|
|
-// return proceed;
|
|
|
-// }
|
|
|
-
|
|
|
-// @Around("@annotation(ProcessingElapsed)")
|
|
|
-// public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
|
|
-// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
|
|
-// ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
|
|
|
-//
|
|
|
-// // 여러 개의 값 가져오기
|
|
|
-// String processNames = annotation != null ? String.join(", ", annotation.value()) : "Unknown Process";
|
|
|
-//
|
|
|
-// long start = System.currentTimeMillis();
|
|
|
-// Object proceed = joinPoint.proceed();
|
|
|
-// long executionTime = System.currentTimeMillis() - start;
|
|
|
-//
|
|
|
-// log.info("[05MIN...] {} 종료, 실행 시간: {} ms", processNames, executionTime);
|
|
|
-// return proceed;
|
|
|
-// }
|
|
|
-// @Around("@annotation(ProcessingElapsed)")
|
|
|
-// public Object logExecutionTime2(ProceedingJoinPoint joinPoint) throws Throwable {
|
|
|
-// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
|
|
-// ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
|
|
|
-//
|
|
|
-// // 배열을 List로 변환
|
|
|
-// List<String> processNameList = annotation != null ? Arrays.asList(annotation.value()) : Collections.emptyList();
|
|
|
-// String processNames = String.join(", ", processNameList);
|
|
|
-//
|
|
|
-// long start = System.currentTimeMillis();
|
|
|
-// Object proceed = joinPoint.proceed();
|
|
|
-// long executionTime = System.currentTimeMillis() - start;
|
|
|
-//
|
|
|
-// log.info("[05MIN...] {} 종료, 실행 시간: {} ms", processNames, executionTime);
|
|
|
-// return proceed;
|
|
|
-// }
|
|
|
-// @Around("@annotation(com.utic.com\.utic\.common\.common.annotation.ProcessingElapsed)")
|
|
|
-// public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
|
|
-// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
|
|
-// ProcessingElapsed annotation = signature.getMethod().getAnnotation(ProcessingElapsed.class);
|
|
|
-//
|
|
|
-// String processName = annotation != null ? annotation.processName() : "Unknown Process";
|
|
|
-// String description = annotation != null ? annotation.description() : "No Description";
|
|
|
-//
|
|
|
-// long start = System.currentTimeMillis();
|
|
|
-// Object proceed = joinPoint.proceed();
|
|
|
-// long executionTime = System.currentTimeMillis() - start;
|
|
|
-//
|
|
|
-// log.info("[05MIN...] {} 종료, 실행 시간: {} ms (설명: {})", processName, executionTime, description);
|
|
|
-// return proceed;
|
|
|
-// }
|
|
|
-}
|