You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by yo...@apache.org on 2023/01/11 02:56:13 UTC

[iotdb] branch Formatting-configuration-variables-log created (now e64bc1be59)

This is an automated email from the ASF dual-hosted git repository.

yongzao pushed a change to branch Formatting-configuration-variables-log
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at e64bc1be59 Finish

This branch includes the following new commits:

     new e64bc1be59 Finish

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: Finish

Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yongzao pushed a commit to branch Formatting-configuration-variables-log
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e64bc1be594599524b66565ce744ce351848b5ce
Author: YongzaoDan <53...@qq.com>
AuthorDate: Wed Jan 11 10:56:04 2023 +0800

    Finish
---
 .../iotdb/confignode/conf/ConfigNodeConfig.java    | 13 ++++++++++
 .../iotdb/confignode/service/ConfigNode.java       |  4 +++
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 29 +++++++++++++++++++---
 .../java/org/apache/iotdb/db/service/DataNode.java |  3 ++-
 4 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
index 1b48ba80b1..bd3a811257 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
@@ -312,6 +312,19 @@ public class ConfigNodeConfig {
     return dir;
   }
 
+  public static String getEnvironmentVariables() {
+    return "\n\t"
+        + ConfigNodeConstant.CONFIGNODE_HOME
+        + "="
+        + System.getProperty(ConfigNodeConstant.CONFIGNODE_HOME, "null")
+        + ";"
+        + "\n\t"
+        + ConfigNodeConstant.CONFIGNODE_CONF
+        + "="
+        + System.getProperty(ConfigNodeConstant.CONFIGNODE_CONF, "null")
+        + ";";
+  }
+
   public String getClusterName() {
     return clusterName;
   }
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java b/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
index f7318c9969..4310c267ee 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
@@ -78,6 +78,10 @@ public class ConfigNode implements ConfigNodeMBean {
   }
 
   public static void main(String[] args) {
+    LOGGER.info(
+        ConfigNodeConstant.GLOBAL_NAME
+            + " environment variables: "
+            + ConfigNodeConfig.getEnvironmentVariables());
     new ConfigNodeCommandLine().doMain(args);
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index acafb58bb7..5b22a5fdf7 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -3338,8 +3338,26 @@ public class IoTDBConfig {
     this.dataRatisConsensusLogAppenderBufferSizeMax = dataRatisConsensusLogAppenderBufferSizeMax;
   }
 
+  public static String getEnvironmentVariables() {
+    return "\n\t"
+        + IoTDBConstant.IOTDB_HOME
+        + "="
+        + System.getProperty(IoTDBConstant.IOTDB_HOME, "null")
+        + ";"
+        + "\n\t"
+        + IoTDBConstant.IOTDB_CONF
+        + "="
+        + System.getProperty(IoTDBConstant.IOTDB_CONF, "null")
+        + ";"
+        + "\n\t"
+        + IoTDBConstant.IOTDB_DATA_HOME
+        + "="
+        + System.getProperty(IoTDBConstant.IOTDB_DATA_HOME, "null")
+        + ";";
+  }
+
   public String getConfigMessage() {
-    String configMessage = "";
+    StringBuilder configMessage = new StringBuilder();
     String configContent;
     String[] notShowArray = {
       "NODE_NAME_MATCHER",
@@ -3363,12 +3381,17 @@ public class IoTDBConfig {
         } else {
           configContent = configField.get(this).toString();
         }
-        configMessage = configMessage + configField.getName() + "=" + configContent + "; ";
+        configMessage
+            .append("\n\t")
+            .append(configField.getName())
+            .append("=")
+            .append(configContent)
+            .append(";");
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
-    return configMessage;
+    return configMessage.toString();
   }
 
   public long getDataRatisConsensusSnapshotTriggerThreshold() {
diff --git a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
index e3f50f7639..f6ebe9a817 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -138,6 +138,7 @@ public class DataNode implements DataNodeMBean {
   }
 
   public static void main(String[] args) {
+    logger.info("IoTDB-DataNode environment variables: " + IoTDBConfig.getEnvironmentVariables());
     new DataNodeServerCommandLine().doMain(args);
   }
 
@@ -170,7 +171,7 @@ public class DataNode implements DataNodeMBean {
       // Setup metric service
       setUpMetricService();
 
-      logger.info("IoTDB configuration: " + config.getConfigMessage());
+      logger.info("IoTDB configuration variables: " + config.getConfigMessage());
       logger.info("Congratulation, IoTDB DataNode is set up successfully. Now, enjoy yourself!");
 
     } catch (StartupException | ConfigurationException | IOException e) {