瀏覽代碼

增加Sequence初始化日志.

https://github.com/baomidou/mybatis-plus/issues/5233
nieqiurong 2 年之前
父節點
當前提交
0d2718e865
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/Sequence.java

+ 8 - 0
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/Sequence.java

@@ -80,6 +80,13 @@ public class Sequence {
         this.inetAddress = inetAddress;
         this.datacenterId = getDatacenterId(maxDatacenterId);
         this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
+        initLog();
+    }
+
+    private void initLog() {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Initialization Sequence datacenterId:" + this.datacenterId + " workerId:" + this.workerId);
+        }
     }
 
     /**
@@ -95,6 +102,7 @@ public class Sequence {
             String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
         this.workerId = workerId;
         this.datacenterId = datacenterId;
+        initLog();
     }
 
     /**