From 50f0cad4c2316a3dbf66a4fa83c66b6f62e01630 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Wed, 25 Oct 2023 16:44:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90errorLog=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/common/util/LogFileUtil.java | 8 +------- .../java/org/jeecg/modules/FileSourceHandleManager.java | 8 +++++++- .../main/java/org/jeecg/modules/UndealHandleManager.java | 8 +++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/common/util/LogFileUtil.java b/jeecg-module-auto-process/src/main/java/org/jeecg/common/util/LogFileUtil.java index 3bc540cb..513e0b0a 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/common/util/LogFileUtil.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/common/util/LogFileUtil.java @@ -29,7 +29,7 @@ public class LogFileUtil { private SpectrumPathProperties spectrumPathProperties; - public void errorLog(String spectrumFileName, long millis, Exception e) { + public void errorLog(String spectrumFileName, String warning, Exception e) { String logFilePath = spectrumPathProperties.getRootPath() + File.separator + spectrumPathProperties.getLogPath() + File.separator + "Error"; File logPath = new File(logFilePath); if (!logPath.exists()) { @@ -40,12 +40,6 @@ public class LogFileUtil { StringBuffer out = new StringBuffer(); String nowDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"); out.append(nowDate+ StringPool.SPACE + "Data Anlyse Error:"); - String warning = ""; - if (e.getClass().equals(StationNotFoundException.class)) { - warning = e.getMessage()+StringPool.SPACE+"timeout:"+(long) Math.floor(millis/1000)+",waittime:"+taskProperties.getUndealFileTimeOut(); - } else { - warning = e.getMessage(); - } out.append(warning); out.append(System.lineSeparator()); out.append(System.lineSeparator()); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/FileSourceHandleManager.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/FileSourceHandleManager.java index c1f32776..6d0ddaec 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/FileSourceHandleManager.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/FileSourceHandleManager.java @@ -147,7 +147,13 @@ public class FileSourceHandleManager{ } }catch (Exception e){ //生成日志 - spectrumServiceQuotes.getLogFileUtil().errorLog(spectrumFile.getName(), 0, e); + String warning = ""; + if (e.getClass().equals(StationNotFoundException.class)) { + warning = e.getMessage()+StringPool.SPACE+"timeout:0,waittime:"+taskProperties.getUndealFileTimeOut(); + } else { + warning = e.getMessage(); + } + spectrumServiceQuotes.getLogFileUtil().errorLog(spectrumFile.getName(), warning, e); log.error("Parsing the {} file of the filesource directory failed.The reason is {}",spectrumFile.getName(),e.getMessage()); e.printStackTrace(); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/UndealHandleManager.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/UndealHandleManager.java index 55866552..ea867546 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/UndealHandleManager.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/UndealHandleManager.java @@ -157,7 +157,13 @@ public class UndealHandleManager{ }catch (Exception e){ //生成日志 long millis = currentMillis - createMillis; - spectrumServiceQuotes.getLogFileUtil().errorLog(spectrumFile.getName(), millis, e); + String warning = ""; + if (e.getClass().equals(StationNotFoundException.class)) { + warning = e.getMessage()+StringPool.SPACE+"timeout:"+(long) Math.floor(millis/1000)+",waittime:"+taskProperties.getUndealFileTimeOut(); + } else { + warning = e.getMessage(); + } + spectrumServiceQuotes.getLogFileUtil().errorLog(spectrumFile.getName(), warning, e); log.error("The {} file of the undeal directory fails to be parsed again.The reason is {}",spectrumFile.getName(),e.getMessage()); e.printStackTrace(); }finally {