生成errorLog传参内容修改
This commit is contained in:
parent
4e49e29324
commit
50f0cad4c2
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user