You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/16 01:51:39 UTC

[GitHub] [rocketmq] mxsm commented on a diff in pull request #5709: [ISSUE #5708]Fix NamesrvStartup can't print config when use -p command

mxsm commented on code in PR #5709:
URL: https://github.com/apache/rocketmq/pull/5709#discussion_r1050298787


##########
namesrv/src/main/java/org/apache/rocketmq/namesrv/NamesrvStartup.java:
##########
@@ -112,25 +113,26 @@ public static void parseCommandlineAndConfigFile(String[] args) throws Exception
             }
         }
 
+        MixAll.properties2Object(ServerUtil.commandLine2Properties(commandLine), namesrvConfig);
         if (commandLine.hasOption('p')) {
-            MixAll.printObjectProperties(null, namesrvConfig);
-            MixAll.printObjectProperties(null, nettyServerConfig);
-            MixAll.printObjectProperties(null, nettyClientConfig);
-            MixAll.printObjectProperties(null, controllerConfig);
+            MixAll.printObjectProperties(LOGGER_CONSOLE, namesrvConfig);
+            MixAll.printObjectProperties(LOGGER_CONSOLE, nettyServerConfig);
+            MixAll.printObjectProperties(LOGGER_CONSOLE, nettyClientConfig);
+            if (namesrvConfig.isEnableControllerInNamesrv()) {
+                MixAll.printObjectProperties(LOGGER_CONSOLE, controllerConfig);
+            }
             System.exit(0);
         }
 
-        MixAll.properties2Object(ServerUtil.commandLine2Properties(commandLine), namesrvConfig);
-
         if (null == namesrvConfig.getRocketmqHome()) {
             System.out.printf("Please set the %s variable in your environment to match the location of the RocketMQ installation%n", MixAll.ROCKETMQ_HOME_ENV);
             System.exit(-2);
         }
 
-        log = LoggerFactory.getLogger(LoggerName.NAMESRV_LOGGER_NAME);
+        LOGGER = LoggerFactory.getLogger(LoggerName.NAMESRV_LOGGER_NAME);

Review Comment:
   @Oliverwqcwrw I think it is fine to keep it as is because LOGGER is not used when the startup fails or when the -p command is used. Reducing unnecessary loads helps to reduce startup time in some cases. Of course, it is also possible to initialize it at the beginning.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org