Bladeren bron

服务日志添加容器编号

andy 1 jaar geleden
bovenliggende
commit
2f61d7d058
1 gewijzigde bestanden met toevoegingen van 6 en 0 verwijderingen
  1. 6 0
      src/main/java/com/scbfkj/uni/service/LoggerService.java

+ 6 - 0
src/main/java/com/scbfkj/uni/service/LoggerService.java

@@ -31,6 +31,9 @@ public class LoggerService {
     private static String currentFileName;
 
     public static void log(LogType type, Map<String, Object> data) {
+        if ((LogType.SERVICE == type || LogType.SERVICE_ERR == type) && data != null) {
+            data.put("containercode", Config.getContainerCode());
+        }
         long filename = System.currentTimeMillis() / Config.getSplitCount();
         currentFileName = filename + ".sqlite";
         String filePath = DIR + currentFileName;
@@ -73,6 +76,9 @@ public class LoggerService {
     }
 
     public static void sendMessage() {
+
+        long filename = System.currentTimeMillis() / Config.getSplitCount();
+        currentFileName = filename + ".sqlite";
 //        判断目录
 
         File file = new File(DIR);