From 568bf0fa150ec8566629dd38b1e9d2f377adb3e6 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 15 Feb 2022 14:31:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=AE=9A=E6=97=B6=E6=B8=85?= =?UTF-8?q?=E7=90=86=E6=8A=A5=E5=91=8A=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job/sechedule/CleanUpReportJob.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/job/sechedule/CleanUpReportJob.java b/backend/src/main/java/io/metersphere/job/sechedule/CleanUpReportJob.java index 3a3e0c57e0..d5ac6acc15 100644 --- a/backend/src/main/java/io/metersphere/job/sechedule/CleanUpReportJob.java +++ b/backend/src/main/java/io/metersphere/job/sechedule/CleanUpReportJob.java @@ -32,6 +32,7 @@ public class CleanUpReportJob extends MsScheduleJob { @Override void businessExecute(JobExecutionContext context) { + LogUtil.info("clean up report start."); Project project = projectService.getProjectById(resourceId); Boolean cleanTrackReport = project.getCleanTrackReport(); Boolean cleanApiReport = project.getCleanApiReport(); @@ -47,8 +48,10 @@ public class CleanUpReportJob extends MsScheduleJob { this.cleanUpLoadReport(project.getCleanLoadReportExpr()); } } catch (Exception e) { - LogUtil.error(e); + LogUtil.error("clean up report error."); + LogUtil.error(e.getMessage(), e); } + LogUtil.info("clean up report end."); } public static JobKey getJobKey(String projectId) { @@ -64,7 +67,7 @@ public class CleanUpReportJob extends MsScheduleJob { if (time == 0) { return; } - LogUtil.info("clean up track plan report before: " + DateUtils.getTimeString(time)); + LogUtil.info("clean up track plan report before: " + DateUtils.getTimeString(time) + ", resourceId : " + resourceId); projectService.cleanUpTrackReport(time, resourceId); } @@ -73,7 +76,7 @@ public class CleanUpReportJob extends MsScheduleJob { if (time == 0) { return; } - LogUtil.info("clean up api report before: " + DateUtils.getTimeString(time)); + LogUtil.info("clean up api report before: " + DateUtils.getTimeString(time) + ", resourceId : " + resourceId); projectService.cleanUpApiReport(time, resourceId); } @@ -82,7 +85,7 @@ public class CleanUpReportJob extends MsScheduleJob { if (time == 0) { return; } - LogUtil.info("clean up load report before: " + DateUtils.getTimeString(time)); + LogUtil.info("clean up load report before: " + DateUtils.getTimeString(time) + ", resourceId : " + resourceId); projectService.cleanUpLoadReport(time, resourceId); } @@ -99,9 +102,11 @@ public class CleanUpReportJob extends MsScheduleJob { date = localDate.minusMonths(quantity); } else if (StringUtils.equals(unit, UNIT_YEAR)) { date = localDate.minusYears(quantity); + } else { + LogUtil.error("clean up expr parse error. expr : " + expr); } } catch (Exception e) { - LogUtil.error(e); + LogUtil.error(e.getMessage(), e); LogUtil.error("clean up job. get clean date error. project : " + resourceId); } }