From bd2d0ba1709c254d4b8f5b466755a1de76b1bcc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=B8=85?= <62982788+597365581@users.noreply.github.com> Date: Fri, 29 Jan 2021 10:12:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[Bug][LoggerServer]=20task=20log=20can=20?= =?UTF-8?q?not=20refresh=20in=20time=C2=A0#4617?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix [Bug][LoggerServer] task log can not refresh in timeĀ #4617 --- .../server/worker/task/AbstractCommandExecutor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java index da5c0e6980..bf306e51bc 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java @@ -348,12 +348,14 @@ public abstract class AbstractCommandExecutor { long lastFlushTime = System.currentTimeMillis(); - while ((line = inReader.readLine()) != null) { + while ((line = inReader.readLine()) != null || logBuffer.size()>0) { if (line.startsWith("${setValue(")) { varPool.append(line.substring("${setValue(".length(), line.length() - 2)); varPool.append("$VarPool$"); } else { + if(null != line){ logBuffer.add(line); + } lastFlushTime = flush(lastFlushTime); } } @@ -560,4 +562,4 @@ public abstract class AbstractCommandExecutor { protected abstract String commandInterpreter(); protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException; -} \ No newline at end of file +}