From 18c69a8500c032e8cc35356ee541327b47442cc7 Mon Sep 17 00:00:00 2001 From: qiaozhanwei Date: Sun, 19 Jan 2020 11:04:56 +0800 Subject: [PATCH] LoggerService Logger RPC PORT get Error modify . #1848 (#1857) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #1775 bugļ¼Œdelete process definition when process instance is running * revert CONTRIBUTING.md * dockerfile modify * dockerfile modify * dockerfile modify * remove install.sh server.servlet.context-path replace * add LoggerServer RPC PORT modified. #1848 * LoggerService Logger RPC PORT get Error modify . #1848 --- .../api/service/LoggerService.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/LoggerService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/LoggerService.java index 20a444523..bf34daf83 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/LoggerService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/LoggerService.java @@ -20,6 +20,7 @@ import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.log.LogClient; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; +import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.dao.ProcessDao; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.commons.lang3.StringUtils; @@ -63,12 +64,14 @@ public class LoggerService { Result result = new Result(Status.SUCCESS.getCode(), Status.SUCCESS.getMsg()); - logger.info("log host : {} , logPath : {} , logServer port : {}",host,taskInstance.getLogPath(),Constants.RPC_PORT); + int port = PropertyUtils.getInt(Constants.LOGGER_SERVER_RPC_PORT); - LogClient logClient = new LogClient(host, Constants.RPC_PORT); + logger.info("log host : {} , logPath : {} , logServer port : {}",host,taskInstance.getLogPath(),port); + + LogClient logClient = new LogClient(host, port); String log = logClient.rollViewLog(taskInstance.getLogPath(),skipLineNum,limit); + result.setData(log); - logger.info(log); return result; } @@ -80,12 +83,18 @@ public class LoggerService { * @return log byte array */ public byte[] getLogBytes(int taskInstId) { + TaskInstance taskInstance = processDao.findTaskInstanceById(taskInstId); if (taskInstance == null){ throw new RuntimeException("task instance is null"); } String host = taskInstance.getHost(); - LogClient logClient = new LogClient(host, Constants.RPC_PORT); + + int port = PropertyUtils.getInt(Constants.LOGGER_SERVER_RPC_PORT); + + logger.info("log host : {} , logPath : {} , logServer port : {}",host,taskInstance.getLogPath(),port); + + LogClient logClient = new LogClient(host, port); return logClient.getLogBytes(taskInstance.getLogPath()); } } -- GitLab