You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2022/07/28 11:44:16 UTC

[rocketmq] branch develop updated: [ISSUE #4677] Optimize information when the variable is not set (#4694)

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

duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4604e5dd6 [ISSUE #4677] Optimize information when the variable is not set (#4694)
4604e5dd6 is described below

commit 4604e5dd6a924806f47f5add6e8a28900f2a2dd7
Author: Oliver <wq...@163.com>
AuthorDate: Thu Jul 28 19:44:03 2022 +0800

    [ISSUE #4677] Optimize information when the variable is not set (#4694)
---
 .../src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java b/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
index 383a99a5b..fb017356a 100644
--- a/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
+++ b/proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java
@@ -23,9 +23,11 @@ import ch.qos.logback.core.joran.spi.JoranException;
 import java.util.Date;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.rocketmq.broker.BrokerController;
 import org.apache.rocketmq.broker.BrokerStartup;
 import org.apache.rocketmq.client.log.ClientLogger;
+import org.apache.rocketmq.common.MixAll;
 import org.apache.rocketmq.common.constant.LoggerName;
 import org.apache.rocketmq.common.thread.ThreadPoolMonitor;
 import org.apache.rocketmq.logging.InternalLogger;
@@ -168,6 +170,12 @@ public class ProxyStartup {
         lc.reset();
         //https://logback.qos.ch/manual/configuration.html
         lc.setPackagingDataEnabled(false);
-        configurator.doConfigure(ConfigurationManager.getProxyHome() + "/conf/logback_proxy.xml");
+        final String home = ConfigurationManager.getProxyHome();
+        if (StringUtils.isEmpty(home)) {
+            System.out.printf("Please set the %s variable or %s variable in your environment to match the location of the RocketMQ installation%n",
+                MixAll.ROCKETMQ_HOME_ENV, ConfigurationManager.RMQ_PROXY_HOME);
+            System.exit(-1);
+        }
+        configurator.doConfigure(home + "/conf/logback_proxy.xml");
     }
 }
\ No newline at end of file