Skip to content

Commit b50d662

Browse files
authored
Merge b33fd86 into e00121b
2 parents e00121b + b33fd86 commit b50d662

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public enum Status {
131131
VERIFY_USERNAME_ERROR(10100, "verify username error", "用户名验证错误"),
132132
UNAUTHORIZED_USER_ERROR(10101, "unauthorized user error", "查询未授权用户错误"),
133133
AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"),
134-
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"),
134+
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error: {0}", "查询任务实例日志错误: {0}"),
135135
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"),
136136
CREATE_PROCESS_DEFINITION_ERROR(10105, "create process definition error", "创建工作流错误"),
137137
VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"),

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/LoggerServiceImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ private String queryLog(TaskInstance taskInstance, int skipLineNum, int limit) {
188188
final String logPath = taskInstance.getLogPath();
189189
log.info("Query task instance log, taskInstanceId:{}, taskInstanceName:{}, host: {}, logPath:{}",
190190
taskInstance.getId(), taskInstance.getName(), taskInstance.getHost(), logPath);
191+
if (StringUtils.isBlank(logPath)) {
192+
throw new ServiceException(Status.QUERY_TASK_INSTANCE_LOG_ERROR,
193+
"TaskInstanceLogPath is empty, maybe the taskInstance doesn't be dispatched");
194+
}
195+
191196
StringBuilder sb = new StringBuilder();
192197
if (skipLineNum == 0) {
193198
String head = String.format(LOG_HEAD_FORMAT,
@@ -213,7 +218,7 @@ private String queryLog(TaskInstance taskInstance, int skipLineNum, int limit) {
213218
}
214219
return sb.toString();
215220
} catch (Throwable ex) {
216-
throw new ServiceException(Status.QUERY_TASK_INSTANCE_LOG_ERROR, ex);
221+
throw new ServiceException(Status.QUERY_TASK_INSTANCE_LOG_ERROR, ex.getMessage(), ex);
217222
}
218223
}
219224

0 commit comments

Comments
 (0)