mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 17:36:47 +08:00
换日志级别,调试
This commit is contained in:
@@ -182,7 +182,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
}
|
||||
} else {
|
||||
// 接口调用失败
|
||||
log.warn("上传案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
log.error("上传案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
if (attempt == maxRetries) {
|
||||
// 最后一次尝试仍然失败
|
||||
saveCaseDocumentLog(caseId, caseEntity.getTitle(), CaseDocumentLogOptTypeEnum.CREATE.getCode(), uploadUrl,
|
||||
@@ -195,7 +195,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 接口调用异常
|
||||
log.warn("上传案例文档接口调用异常,第{}次尝试", attempt, e);
|
||||
log.error("上传案例文档接口调用异常,第{}次尝试", attempt, e);
|
||||
if (attempt == maxRetries) {
|
||||
// 最后一次尝试仍然异常
|
||||
log.error("上传案例文档最终失败,已重试{}次", maxRetries);
|
||||
@@ -308,7 +308,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
}
|
||||
} else {
|
||||
// 接口调用失败
|
||||
log.warn("删除案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
log.error("删除案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
if (attempt == maxRetries) {
|
||||
// 最后一次尝试仍然失败
|
||||
saveCaseDocumentLog(caseId, caseEntity.getTitle(), CaseDocumentLogOptTypeEnum.DELETE.getCode(), deleteUrl,
|
||||
@@ -321,7 +321,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 接口调用异常
|
||||
log.warn("删除案例文档接口调用异常,第{}次尝试", attempt, e);
|
||||
log.error("删除案例文档接口调用异常,第{}次尝试", attempt, e);
|
||||
if (attempt == maxRetries) {
|
||||
// 最后一次尝试仍然异常
|
||||
log.error("删除案例文档最终失败,已重试{}次", maxRetries);
|
||||
@@ -369,14 +369,14 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
FieldFilters.eq("caseId", caseId));
|
||||
|
||||
if (logList.isEmpty()) {
|
||||
log.warn("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
||||
log.error("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
||||
return false;
|
||||
}
|
||||
|
||||
CaseDocumentLog latestLog = logList.get(0);
|
||||
String oldTaskId = latestLog.getTaskId();
|
||||
if (StringUtil.isBlank(oldTaskId)) {
|
||||
log.warn("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
||||
log.error("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
||||
return false;
|
||||
}
|
||||
String requestBody = "";
|
||||
@@ -400,7 +400,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
requestUrl = caseAiProperties.getBaseUrl() + "/apigateway/knowledge/v1/file/upload";
|
||||
// 1. 检查文件路径
|
||||
if (StringUtil.isBlank(caseEntity.getFilePath())) {
|
||||
log.warn("调用上传接口失败,案例文件路径为空,caseId: {}", caseId);
|
||||
log.error("调用上传接口失败,案例文件路径为空,caseId: {}", caseId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
String filePath = savePath + caseEntity.getFilePath();
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
log.warn("调用上传接口失败,案例文件不存在,filePath: {}", filePath);
|
||||
log.error("调用上传接口失败,案例文件不存在,filePath: {}", filePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
// 业务处理失败
|
||||
newOptStatus = CaseDocumentLogOptStatusEnum.SUCCESS.getCode(); // 接口调用成功
|
||||
newCaseStatus = CaseDocumentLogCaseStatusEnum.FAILED.getCode(); // 业务处理失败
|
||||
log.warn("文档上传业务处理失败,taskId: {}, message: {}", taskId, message);
|
||||
log.error("文档上传业务处理失败,taskId: {}, message: {}", taskId, message);
|
||||
} else {
|
||||
log.error("未知的fileStatus: {}, taskId: {}", fileStatus, taskId);
|
||||
return false;
|
||||
@@ -564,7 +564,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
|
||||
if (taskIds.isEmpty()) {
|
||||
log.warn("所有运行中的记录都没有有效的taskId");
|
||||
log.error("所有运行中的记录都没有有效的taskId");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -663,14 +663,14 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
FieldFilters.eq("caseId", caseId));
|
||||
|
||||
if (logList.isEmpty()) {
|
||||
log.warn("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
||||
log.error("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
||||
return false;
|
||||
}
|
||||
|
||||
CaseDocumentLog latestLog = logList.get(0);
|
||||
String taskId = latestLog.getTaskId();
|
||||
if (StringUtil.isBlank(taskId)) {
|
||||
log.warn("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
||||
log.error("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -710,19 +710,19 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
return true;
|
||||
} else {
|
||||
// 业务处理失败,不重试
|
||||
log.warn("调用删除接口业务处理失败,不重试,caseId: {}, taskId: {}", caseId, taskId);
|
||||
log.error("调用删除接口业务处理失败,不重试,caseId: {}, taskId: {}", caseId, taskId);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// 业务处理失败,不重试
|
||||
log.warn("调用删除接口业务处理失败,不重试,response: {}", responseBody);
|
||||
log.error("调用删除接口业务处理失败,不重试,response: {}", responseBody);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// 接口调用失败
|
||||
log.warn("调用删除接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
log.error("调用删除接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
if (attempt == maxRetries) {
|
||||
log.warn("调用删除接口最终失败,已重试{}次", maxRetries);
|
||||
log.error("调用删除接口最终失败,已重试{}次", maxRetries);
|
||||
return false;
|
||||
}
|
||||
// 继续下一次重试
|
||||
@@ -730,9 +730,9 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 接口调用异常
|
||||
log.warn("调用删除接口异常,第{}次尝试", attempt, e);
|
||||
log.error("调用删除接口异常,第{}次尝试", attempt, e);
|
||||
if (attempt == maxRetries) {
|
||||
log.warn("调用删除接口最终失败,已重试{}次", maxRetries);
|
||||
log.error("调用删除接口最终失败,已重试{}次", maxRetries);
|
||||
return false;
|
||||
}
|
||||
// 继续下一次重试
|
||||
@@ -785,14 +785,14 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
return taskId;
|
||||
} else {
|
||||
// 业务处理失败,不重试
|
||||
log.warn("调用上传接口业务处理失败,不重试,response: {}", responseBody);
|
||||
log.error("调用上传接口业务处理失败,不重试,response: {}", responseBody);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// 接口调用失败
|
||||
log.warn("调用上传接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
log.error("调用上传接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||
if (attempt == maxRetries) {
|
||||
log.warn("调用上传接口最终失败,已重试{}次", maxRetries);
|
||||
log.error("调用上传接口最终失败,已重试{}次", maxRetries);
|
||||
return null;
|
||||
}
|
||||
// 继续下一次重试
|
||||
@@ -800,9 +800,9 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 接口调用异常
|
||||
log.warn("调用上传接口异常,第{}次尝试", attempt, e);
|
||||
log.error("调用上传接口异常,第{}次尝试", attempt, e);
|
||||
if (attempt == maxRetries) {
|
||||
log.warn("调用上传接口最终失败,已重试{}次", maxRetries);
|
||||
log.error("调用上传接口最终失败,已重试{}次", maxRetries);
|
||||
return null;
|
||||
}
|
||||
// 继续下一次重试
|
||||
@@ -819,7 +819,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
try {
|
||||
com.alibaba.fastjson.JSONArray dataArray = result.getJSONArray("data");
|
||||
if (dataArray == null || dataArray.isEmpty()) {
|
||||
log.warn("文件状态接口返回的data为空");
|
||||
log.error("文件状态接口返回的data为空");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
|
||||
String fileStatus = taskStatusMap.get(taskId);
|
||||
if (StringUtil.isBlank(fileStatus)) {
|
||||
log.warn("未找到taskId对应的文件状态: {}", taskId);
|
||||
log.error("未找到taskId对应的文件状态: {}", taskId);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -875,10 +875,10 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
caseLog.setOptStatus(CaseDocumentLogOptStatusEnum.SUCCESS.getCode());
|
||||
caseLog.setCaseStatus(CaseDocumentLogCaseStatusEnum.FAILED.getCode());
|
||||
needUpdate = true;
|
||||
log.warn("文档处理失败,更新状态,taskId: {}, caseId: {}", caseLog.getTaskId(), caseLog.getCaseId());
|
||||
log.error("文档处理失败,更新状态,taskId: {}, caseId: {}", caseLog.getTaskId(), caseLog.getCaseId());
|
||||
} else {
|
||||
// 其他状态(uploaded、texted、vectoring),不做数据变更
|
||||
log.debug("文档状态为{},暂不更新数据库,taskId: {}", fileStatus, caseLog.getTaskId());
|
||||
log.info("文档状态为{},暂不更新数据库,taskId: {}", fileStatus, caseLog.getTaskId());
|
||||
}
|
||||
|
||||
// 如果需要更新,执行update操作
|
||||
@@ -888,7 +888,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
||||
log.info("更新CaseDocumentLog成功,logId: {}, taskId: {}, fileStatus: {}",
|
||||
caseLog.getId(), caseLog.getTaskId(), fileStatus);
|
||||
} else {
|
||||
log.debug("无需更新CaseDocumentLog,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus);
|
||||
log.info("无需更新CaseDocumentLog,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("更新日志状态异常,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus, e);
|
||||
|
||||
Reference in New Issue
Block a user