You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by lg...@apache.org on 2020/01/19 03:05:06 UTC
[incubator-dolphinscheduler] branch dev-1.2.1 updated:
LoggerService Logger RPC PORT get Error modify . #1848 (#1857)
This is an automated email from the ASF dual-hosted git repository.
lgcareer pushed a commit to branch dev-1.2.1
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev-1.2.1 by this push:
new 18c69a8 LoggerService Logger RPC PORT get Error modify . #1848 (#1857)
18c69a8 is described below
commit 18c69a8500c032e8cc35356ee541327b47442cc7
Author: qiaozhanwei <qi...@outlook.com>
AuthorDate: Sun Jan 19 11:04:56 2020 +0800
LoggerService Logger RPC PORT get Error modify . #1848 (#1857)
* 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
---
.../dolphinscheduler/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 20a4445..bf34daf 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());
}
}