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:35:27 UTC

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

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


##########
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:
   Can LOGGER be initialized directly when variables are defined? Is it better to keep it the same as LOGGER_CONSOLE? WDYT



-- 
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