Open eunja511005 opened 1 year ago
오류 내용 저장
@Aspect @Component @RequiredArgsConstructor public class ExceptionLoggingAspect {
private final ZthhErrorService zthhErrorService;
@AfterThrowing(pointcut = "execution( com.eun...*(..))", throwing = "exception") public void handleException(JoinPoint joinPoint, Exception exception) { saveErrorLog(exception); }
private void saveErrorLog(Exception exception) { String errorMessage = org.apache.tika.utils.ExceptionUtils.getStackTrace(exception);
if (errorMessage.length() > 2000) { errorMessage = errorMessage.substring(0, 2000); } zthhErrorService.save( ZthhErrorDTO.builder().errorMessage("GlobalExceptionHandler Error : " + errorMessage).build()); exception.printStackTrace();
} }
오류 내용 저장
private final ZthhErrorService zthhErrorService;
@AfterThrowing(pointcut = "execution( com.eun...*(..))", throwing = "exception") public void handleException(JoinPoint joinPoint, Exception exception) { saveErrorLog(exception); }
private void saveErrorLog(Exception exception) { String errorMessage = org.apache.tika.utils.ExceptionUtils.getStackTrace(exception);
} }