storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [1/9] storm git commit: fix STORM-1579, checks storm.local.dir property/conf when getting storm log dir
Date Wed, 02 Mar 2016 17:27:34 GMT
Repository: storm
Updated Branches:
  refs/heads/master d42c43725 -> 906fcea61


fix STORM-1579, checks storm.local.dir property/conf when getting storm log dir


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/034f0cf1
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/034f0cf1
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/034f0cf1

Branch: refs/heads/master
Commit: 034f0cf107403100650d6eb65e7168f62133864a
Parents: 07629c1
Author: 卫乐 <weiyue.wy@taobao.com>
Authored: Sun Feb 28 22:33:21 2016 +0800
Committer: 卫乐 <weiyue.wy@taobao.com>
Committed: Sun Feb 28 22:33:21 2016 +0800

----------------------------------------------------------------------
 .../src/jvm/org/apache/storm/utils/ConfigUtils.java      |  6 +++++-
 storm-core/test/clj/org/apache/storm/supervisor_test.clj | 11 +++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/034f0cf1/storm-core/src/jvm/org/apache/storm/utils/ConfigUtils.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/utils/ConfigUtils.java b/storm-core/src/jvm/org/apache/storm/utils/ConfigUtils.java
index 4a0564f..b4b3ea6 100644
--- a/storm-core/src/jvm/org/apache/storm/utils/ConfigUtils.java
+++ b/storm-core/src/jvm/org/apache/storm/utils/ConfigUtils.java
@@ -66,7 +66,11 @@ public class ConfigUtils {
             dir = System.getProperty("storm.log.dir");
         } else if ((conf = readStormConfig()).get("storm.log.dir") != null) {
             dir = String.valueOf(conf.get("storm.log.dir"));
-        } else  {
+        } else if (System.getProperty("storm.local.dir") != null) {
+            dir = System.getProperty("storm.local.dir");
+        } else if (conf.get("storm.local.dir") != null) {
+            dir = conf.get("storm.local.dir") + FILE_SEPARATOR + "logs";
+        } else {
             dir = concatIfNotNull(System.getProperty("storm.home")) + FILE_SEPARATOR + "logs";
         }
         try {

http://git-wip-us.apache.org/repos/asf/storm/blob/034f0cf1/storm-core/test/clj/org/apache/storm/supervisor_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/org/apache/storm/supervisor_test.clj b/storm-core/test/clj/org/apache/storm/supervisor_test.clj
index cdd66e4..415a56d 100644
--- a/storm-core/test/clj/org/apache/storm/supervisor_test.clj
+++ b/storm-core/test/clj/org/apache/storm/supervisor_test.clj
@@ -297,6 +297,7 @@
     (let [mock-port "42"
           mock-storm-id "fake-storm-id"
           mock-worker-id "fake-worker-id"
+          storm-log-dir (ConfigUtils/getLogDir)
           mock-cp (str Utils/FILE_PATH_SEPARATOR "base" Utils/CLASS_PATH_SEPARATOR Utils/FILE_PATH_SEPARATOR
"stormjar.jar")
           mock-sensitivity "S3"
           mock-cp "/base:/stormjar.jar"
@@ -308,7 +309,7 @@
                                (str "-Dstorm.id=" mock-storm-id)
                                (str "-Dworker.id=" mock-worker-id)
                                (str "-Dworker.port=" mock-port)
-                               "-Dstorm.log.dir=/logs"
+                               (str "-Dstorm.log.dir=" storm-log-dir)
                                "-Dlog4j.configurationFile=/log4j2/worker.xml"
                                "-DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector"
                                "org.apache.storm.LogWriter"]
@@ -321,7 +322,7 @@
                                 "-Dworkers.artifacts=/tmp/workers-artifacts"
                                 "-Dstorm.conf.file="
                                 "-Dstorm.options="
-                                (str "-Dstorm.log.dir=" Utils/FILE_PATH_SEPARATOR "logs")
+                                (str "-Dstorm.log.dir=" storm-log-dir)
                                 (str "-Dlogging.sensitivity=" mock-sensitivity)
                                 (str "-Dlog4j.configurationFile=" Utils/FILE_PATH_SEPARATOR
"log4j2" Utils/FILE_PATH_SEPARATOR "worker.xml")
                                 "-DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector"
@@ -484,6 +485,7 @@
           mock-cp "mock-classpath'quote-on-purpose"
           attrs (make-array FileAttribute 0)
           storm-local (.getCanonicalPath (.toFile (Files/createTempDirectory "storm-local"
attrs)))
+          storm-log-dir (ConfigUtils/getLogDir)
           worker-script (str storm-local "/workers/" mock-worker-id "/storm-worker-script.sh")
           exp-launch ["/bin/worker-launcher"
                       "me"
@@ -499,7 +501,7 @@
                                " '-Dstorm.id=" mock-storm-id "'"
                                " '-Dworker.id=" mock-worker-id "'"
                                " '-Dworker.port=" mock-port "'"
-                               " '-Dstorm.log.dir=/logs'"
+                               " '-Dstorm.log.dir=" storm-log-dir "'"
                                " '-Dlog4j.configurationFile=/log4j2/worker.xml'"
                                " '-DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector'"
                                " 'org.apache.storm.LogWriter'"
@@ -512,7 +514,7 @@
                                " '-Dworkers.artifacts=" (str storm-local "/workers-artifacts'")
                                " '-Dstorm.conf.file='"
                                " '-Dstorm.options='"
-                               " '-Dstorm.log.dir=/logs'"
+                               " '-Dstorm.log.dir=" storm-log-dir "'"
                                " '-Dlogging.sensitivity=" mock-sensitivity "'"
                                " '-Dlog4j.configurationFile=/log4j2/worker.xml'"
                                " '-DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector'"
@@ -836,3 +838,4 @@
           {"sup1" [3 4]}
           (get-storm-id (:storm-cluster-state cluster) "topology2"))
         )))
+


Mime
View raw message