You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2020/08/11 02:49:41 UTC

[rocketmq] branch develop updated: [ISSUE #2067] Add logs when collecting disk space usage

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

jinrongtong 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 a093f8a  [ISSUE #2067] Add logs when collecting disk space usage
a093f8a is described below

commit a093f8a638f1a1329b0c7567bf38e8590fa668f8
Author: affe <af...@gmail.com>
AuthorDate: Tue Aug 11 10:49:30 2020 +0800

    [ISSUE #2067] Add logs when collecting disk space usage
---
 common/src/main/java/org/apache/rocketmq/common/UtilAll.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/common/src/main/java/org/apache/rocketmq/common/UtilAll.java b/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
index 2aab5b7..639a200 100644
--- a/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
+++ b/common/src/main/java/org/apache/rocketmq/common/UtilAll.java
@@ -200,14 +200,20 @@ public class UtilAll {
     }
 
     public static double getDiskPartitionSpaceUsedPercent(final String path) {
-        if (null == path || path.isEmpty())
+        if (null == path || path.isEmpty()) {
+            log.error("Error when measuring disk space usage, path is null or empty, path : {}", path);
             return -1;
+        }
+
 
         try {
             File file = new File(path);
 
-            if (!file.exists())
+            if (!file.exists()) {
+                log.error("Error when measuring disk space usage, file doesn't exist on this path: {}", path);
                 return -1;
+            }
+
 
             long totalSpace = file.getTotalSpace();
 
@@ -218,6 +224,7 @@ public class UtilAll {
                 return usedSpace / (double) totalSpace;
             }
         } catch (Exception e) {
+            log.error("Error when measuring disk space usage, got exception: :", e);
             return -1;
         }