You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by le...@apache.org on 2021/01/28 09:58:07 UTC

[incubator-dolphinscheduler] branch 1.3.5-prepare updated: [1.3.5-prepare][cherry-pick]#4272 (#4599)

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

leonbao pushed a commit to branch 1.3.5-prepare
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/1.3.5-prepare by this push:
     new f354d64  [1.3.5-prepare][cherry-pick]#4272 (#4599)
f354d64 is described below

commit f354d64432e50960f569cd286674546dab2b91fb
Author: Kirs <ac...@163.com>
AuthorDate: Thu Jan 28 17:58:00 2021 +0800

    [1.3.5-prepare][cherry-pick]#4272 (#4599)
---
 .../dolphinscheduler/server/log/LoggerRequestProcessor.java | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
index a73e473..0628292 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
+++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
@@ -153,10 +153,15 @@ public class LoggerRequestProcessor implements NettyRequestProcessor {
     private List<String> readPartFileContent(String filePath,
                                             int skipLine,
                                             int limit){
-        try (Stream<String> stream = Files.lines(Paths.get(filePath))) {
-            return stream.skip(skipLine).limit(limit).collect(Collectors.toList());
-        } catch (IOException e) {
-            logger.error("read file error",e);
+        File file = new File(filePath);
+        if (file.exists() && file.isFile()) {
+            try (Stream<String> stream = Files.lines(Paths.get(filePath))) {
+                return stream.skip(skipLine).limit(limit).collect(Collectors.toList());
+            } catch (IOException e) {
+                logger.error("read file error",e);
+            }
+        } else {
+            logger.info("file path: {} not exists", filePath);
         }
         return Collections.emptyList();
     }