sunyj пре 7 година
родитељ
комит
8801e2d392
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      src/main/java/com/uas/ps/product/sync/MessageConsumer.java

+ 2 - 2
src/main/java/com/uas/ps/product/sync/MessageConsumer.java

@@ -30,6 +30,7 @@ public class MessageConsumer {
     private static final List<String> topics = Collections.singletonList("RESPONSE");
 
     private static final String LOG_DIR = System.getProperty("java.io.tmpdir");
+    private static final String LOG_FILE_PATH = (LOG_DIR.endsWith(File.separator) ? LOG_DIR : LOG_DIR + "/") + "batch-code-timeout.log";
 
     /**
      * 等待的最大次数
@@ -104,8 +105,7 @@ public class MessageConsumer {
             }
         }
         // 超过最大次数后,记录 batchCode
-        String logFilePath = (LOG_DIR.endsWith(File.separator) ? LOG_DIR : LOG_DIR + "/") + "batch-code-timeout.log";
-        try (FileWriter fileWriter = new FileWriter(logFilePath, true)) {
+        try (FileWriter fileWriter = new FileWriter(LOG_FILE_PATH, true)) {
             fileWriter.write(DateFormatUtils.DATETIME_FORMAT.format(new Date()) + " " + batchCode + "\n");
             fileWriter.flush();
         } catch (IOException e) {