From ec3e7326246b5543089b14e53275e2aca8e39f96 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 06 六月 2023 14:01:39 +0800 Subject: [PATCH] 修改logback日志输出功能 --- src/main/java/com/yssh/scheduled/ReadCsvTask.java | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/yssh/scheduled/ReadCsvTask.java b/src/main/java/com/yssh/scheduled/ReadCsvTask.java index 05c0bf9..1bacaf9 100644 --- a/src/main/java/com/yssh/scheduled/ReadCsvTask.java +++ b/src/main/java/com/yssh/scheduled/ReadCsvTask.java @@ -10,9 +10,8 @@ import com.yssh.entity.VocVals; import com.yssh.service.VocValsService; import com.yssh.utils.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -28,21 +27,21 @@ @Component public class ReadCsvTask { - protected final Log logger = LogFactory.getLog(this.getClass()); + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); @Resource private VocValsService vocValsService; - @Autowired + @Resource private SuYuanServiceImpl suYuanService; - @Autowired + @Resource private CsvFilePathConfig csvFilePathConfig; - @Autowired + @Resource private IDictRecordService dictRecordService; - @Autowired + @Resource private IWarningAnalyseService warningAnalyseService; private final static List<String> md5List = new ArrayList<>(); @@ -65,7 +64,7 @@ File file = new File(filePath); if (!file.exists()) { - logger.error(file.getAbsolutePath() + " is not exist 锛�"); + logger.info(file.getAbsolutePath() + " is not exist 锛�"); continue; } @@ -83,7 +82,7 @@ try { EasyCsv.read(filePath, VocVals.class, new VocParser(vocValsService, calendar.getTime())).doRead(); } catch (Exception e) { - logger.error(e); + logger.error(e.getMessage(), e); } } } @@ -105,7 +104,7 @@ File file = new File(filePath); if (!file.exists()) { - logger.error(file.getAbsolutePath() + " is not exist 锛�"); + logger.info(file.getAbsolutePath() + " is not exist 锛�"); continue; } @@ -150,7 +149,7 @@ String filePath = csvFilePathConfig.getFilePath() + "\\\\" + time + ".csv"; File file = new File(filePath); if (!file.exists()) { - logger.error(file.getAbsolutePath() + " is not exist 锛�"); + logger.info(file.getAbsolutePath() + " is not exist 锛�"); return; } //鍒涘缓琛� -- Gitblit v1.9.3