From d12b204b9dfcdfc6683771285433f450bb3201c4 Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:48:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(log):=20=E8=B0=83=E6=95=B4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95=E7=AD=96=E7=95=A5=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在多个插件的 executeBusiness 方法中添加触发调用的日志记录 - 注释掉部分冗余的日志记录代码,以提高性能 - 修改 logback-spring.xml 配置,暂时移除 ALL_FILE 日志输出 --- .../plugin/outsourc/ConsignmachiningIn.java | 1 + .../outsourc/ConsignmachiningInReturn.java | 1 + .../plugin/purchase/ProxyPurchaseReturn.java | 1 + .../purchase/ProxyPurchaseWarehousOrder.java | 1 + .../ProxyPurchaseWarehousWarehouse.java | 1 + .../sales/SoSaleOutPluginInitializerToB.java | 1 + .../sales/SoSaleOutPluginInitializerToC.java | 1 + .../sales/SoSaleReturnPluginInitializerToB.java | 1 + .../sales/SoSaleReturnPluginInitializerToC.java | 3 ++- .../src/main/resources/logback-spring.xml | 17 +++++++++-------- .../service/impl/EntranceServiceImpl.java | 5 +++-- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java index 13755c0d..1e3bd634 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java @@ -138,6 +138,7 @@ public class ConsignmachiningIn extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java index 63cb3f15..efbc3eac 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java @@ -140,6 +140,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java index 1044ad53..423bf0eb 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java @@ -137,6 +137,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java index 4699462b..f7d6ccf5 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java @@ -131,6 +131,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java index 2a8ebc44..8c18cb09 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java @@ -134,6 +134,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index 77407e41..99f37869 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -115,6 +115,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index 08395c7b..4e6601a4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -119,6 +119,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index b1ab5a9b..1f5bbd7b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -104,6 +104,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index d976a45e..6ef56932 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -103,6 +103,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + logger.info("触发调用:{}" + getPluginName()); try { Thread thread = new Thread(new Runnable() { @Override @@ -142,7 +143,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { } }, "执行插件:" + getPluginName()); thread.start(); - + if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { try { thread.join(); diff --git a/buildpackage/src/main/resources/logback-spring.xml b/buildpackage/src/main/resources/logback-spring.xml index fed8a49d..17f87522 100644 --- a/buildpackage/src/main/resources/logback-spring.xml +++ b/buildpackage/src/main/resources/logback-spring.xml @@ -160,14 +160,15 @@ - + + - - - - - - - + + + + + + + diff --git a/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java b/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java index 08244a06..629a4139 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/entrance/service/impl/EntranceServiceImpl.java @@ -138,10 +138,11 @@ public class EntranceServiceImpl implements IEntranceService { } JsonResultEntity jsonResultEntity; try { + //先注释掉,观察调用的性能 // logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>请求的参数:jsonObject:" + jsonObject.toJSONString()); - logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); +// logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); jsonResultEntity = (JsonResultEntity) m.invoke(object, jsonObject); - logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); +// logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); return jsonResultEntity; } catch (Exception e) { logger.error("METHOD doBusiness invokeException{}", e.getMessage());