提交 18c69a85 编写于 作者: Q qiaozhanwei 提交者: lgcareer

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
上级 4c0147d0
......@@ -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());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册