生成errorLog传参内容修改

This commit is contained in:
qiaoqinzheng 2023-10-25 16:44:45 +08:00
parent 4e49e29324
commit 50f0cad4c2
3 changed files with 15 additions and 9 deletions

View File

@ -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());

View File

@ -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();

View File

@ -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 {