From db5c5e8caef6a729442d390f6f061da475403c45 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 7 Mar 2022 14:54:21 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/exec/queue/ExecThreadPoolExecutor.java | 2 +- .../api/exec/scenario/ApiScenarioSerialService.java | 2 +- .../main/java/io/metersphere/api/jmeter/JMeterService.java | 4 ++-- .../main/java/io/metersphere/api/jmeter/MsDebugListener.java | 2 +- .../main/java/io/metersphere/api/jmeter/MsKafkaListener.java | 4 ++-- .../api/service/ApiEnvironmentRunningParamService.java | 2 +- .../java/io/metersphere/websocket/c/to/c/WebSocketUtils.java | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/exec/queue/ExecThreadPoolExecutor.java b/backend/src/main/java/io/metersphere/api/exec/queue/ExecThreadPoolExecutor.java index 2bc9621946..c6c4900240 100644 --- a/backend/src/main/java/io/metersphere/api/exec/queue/ExecThreadPoolExecutor.java +++ b/backend/src/main/java/io/metersphere/api/exec/queue/ExecThreadPoolExecutor.java @@ -109,7 +109,7 @@ public class ExecThreadPoolExecutor { threadPool.allowCoreThreadTimeOut(true); LoggerUtil.info("AllCoreThreads: " + threadPool.prestartAllCoreThreads()); } catch (Exception e) { - LoggerUtil.error("设置线程参数异常:" + e); + LoggerUtil.error("设置线程参数异常:", e); } } diff --git a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java index cc546683e1..e48604bb72 100644 --- a/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java +++ b/backend/src/main/java/io/metersphere/api/exec/scenario/ApiScenarioSerialService.java @@ -134,7 +134,7 @@ public class ApiScenarioSerialService { ResultDTO dto = new ResultDTO(); BeanUtils.copyBean(dto, runRequest); CommonBeanFactory.getBean(ApiExecutionQueueService.class).queueNext(dto); - LoggerUtil.error("执行终止:" + e.getMessage()); + LoggerUtil.error("执行终止:", e); } } diff --git a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java index b13e922e57..1a3f5b44b1 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/JMeterService.java @@ -129,7 +129,7 @@ public class JMeterService { final Engine engine = EngineFactory.createApiEngine(request); engine.start(); } catch (Exception e) { - LoggerUtil.error("调用K8S执行请求[ " + request.getTestId() + " ] 失败:" + e.getMessage()); + LoggerUtil.error("调用K8S执行请求[ " + request.getTestId() + " ] 失败:", e); ApiScenarioReportService apiScenarioReportService = CommonBeanFactory.getBean(ApiScenarioReportService.class); apiScenarioReportService.delete(request.getReportId()); MSException.throwException(e.getMessage()); @@ -171,7 +171,7 @@ public class JMeterService { } catch (Exception e) { RemakeReportService remakeReportService = CommonBeanFactory.getBean(RemakeReportService.class); remakeReportService.remake(request); - LoggerUtil.error("发送请求[ " + request.getTestId() + " ] 执行失败:" + e.getMessage()); + LoggerUtil.error("发送请求[ " + request.getTestId() + " ] 执行失败:", e); LoggerUtil.error(e); } } diff --git a/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java b/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java index f7171e4515..3ef62c027d 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java @@ -135,7 +135,7 @@ public class MsDebugListener extends AbstractListenerElement implements SampleLi LoggerUtil.debug("send. " + this.getName()); WebSocketUtils.sendMessageSingle(dto); } catch (Exception ex) { - LoggerUtil.error("消息推送失败:" + ex.getMessage()); + LoggerUtil.error("消息推送失败:" , ex); } } diff --git a/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java b/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java index 2d5e5f309e..2d719f5b62 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/MsKafkaListener.java @@ -93,7 +93,7 @@ public class MsKafkaListener { }); } } catch (Exception e) { - LoggerUtil.error("KAFKA消费失败:" + e.getMessage()); + LoggerUtil.error("KAFKA消费失败:", e); } finally { ack.acknowledge(); } @@ -121,7 +121,7 @@ public class MsKafkaListener { return element; } } catch (Exception e) { - LoggerUtil.error("formatResult 格式化数据失败:" + e.getMessage()); + LoggerUtil.error("formatResult 格式化数据失败:", e); } return null; } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiEnvironmentRunningParamService.java b/backend/src/main/java/io/metersphere/api/service/ApiEnvironmentRunningParamService.java index 692d873f69..058b71367f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiEnvironmentRunningParamService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiEnvironmentRunningParamService.java @@ -118,7 +118,7 @@ public class ApiEnvironmentRunningParamService { } } catch (Exception ex) { - LoggerUtil.error("设置环境变量异常:" + ex.getMessage()); + LoggerUtil.error("设置环境变量异常", ex); } } diff --git a/backend/src/main/java/io/metersphere/websocket/c/to/c/WebSocketUtils.java b/backend/src/main/java/io/metersphere/websocket/c/to/c/WebSocketUtils.java index 18bbe21d97..c1702c673a 100644 --- a/backend/src/main/java/io/metersphere/websocket/c/to/c/WebSocketUtils.java +++ b/backend/src/main/java/io/metersphere/websocket/c/to/c/WebSocketUtils.java @@ -50,7 +50,7 @@ public class WebSocketUtils { WebSocketUtils.ONLINE_USER_SESSIONS.remove(("send." + reportId)); } } catch (Exception e) { - LoggerUtil.error("关闭socket失败:" + e.getMessage()); + LoggerUtil.error("关闭socket失败:", e); } } }