rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinrongt...@apache.org
Subject [rocketmq] branch develop updated: [ISSUE #2067] Add logs when collecting disk space usage
Date Tue, 11 Aug 2020 02:49:41 GMT
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 <affeisme@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;
         }
 


Mime
View raw message