storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptgo...@apache.org
Subject [03/24] git commit: use File methods to construct paths
Date Tue, 19 Nov 2013 15:26:40 GMT
use File methods to construct paths


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

Branch: refs/heads/master
Commit: b0a4730524bfba8792c9cfab2b7aeac37fd9ffd0
Parents: 30c5d66
Author: Homer Strong <homer.strong@gmail.com>
Authored: Thu Oct 10 12:48:13 2013 -0700
Committer: Homer Strong <homer.strong@gmail.com>
Committed: Thu Oct 10 12:48:13 2013 -0700

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/daemon/logviewer.clj | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/b0a47305/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/logviewer.clj b/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
index 9bb56b1..1be017d 100644
--- a/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/logviewer.clj
@@ -9,6 +9,7 @@
   (:import [org.apache.commons.logging.impl Log4JLogger])
   (:import [ch.qos.logback.core FileAppender])
   (:import [org.apache.log4j Level])
+  (:import [java.io File])
   (:require [compojure.route :as route]
             [compojure.handler :as handler]
             [clojure.string :as string])
@@ -33,13 +34,11 @@
   []
   (let [appender (first (iterator-seq (.iteratorForAppenders (LoggerFactory/getLogger Logger/ROOT_LOGGER_NAME))))]
     (if (and appender (instance? FileAppender appender))
-      (string/join
-       "/" (butlast
-            (string/split (.getFile appender) #"/")))
-      (str (System/getProperty "storm.home") "/logs/"))))
+      (.getParent (File. (.getFile appender)))
+      (.getCanonicalPath (File. (System/getProperty "storm.home") "logs")))))
 
 (defn log-page [file tail grep]
-  (let [path (str (log-root-dir) "/" file)
+  (let [path (.getCanonicalPath (File. (log-root-dir) file))
         tail (if tail
                (min 10485760 (Integer/parseInt tail))
                10240)


Mime
View raw message