refactor(log): 调整日志记录策略并优化相关代码

- 在多个插件的 executeBusiness 方法中添加触发调用的日志记录
- 注释掉部分冗余的日志记录代码,以提高性能
- 修改 logback-spring.xml 配置,暂时移除 ALL_FILE 日志输出
This commit is contained in:
liuy 2024-10-28 11:48:43 +08:00
parent 14a21b3168
commit d12b204b9d
11 changed files with 22 additions and 11 deletions

View File

@ -138,6 +138,7 @@ public class ConsignmachiningIn extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -140,6 +140,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -137,6 +137,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -131,6 +131,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -134,6 +134,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -115,6 +115,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -119,6 +119,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -104,6 +104,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override

View File

@ -103,6 +103,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("触发调用:{}" + getPluginName());
try { try {
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
@ -142,7 +143,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
} }
}, "执行插件:" + getPluginName()); }, "执行插件:" + getPluginName());
thread.start(); thread.start();
if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) { if (requestJson != null && requestJson.get("type") != null && ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
try { try {
thread.join(); thread.join();

View File

@ -160,14 +160,15 @@
<appender-ref ref="INFO_FILE"/> <appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/> <appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/> <appender-ref ref="ERROR_FILE"/>
<appender-ref ref="ALL_FILE"/> <!-- <appender-ref ref="ALL_FILE"/>-->
</root> </root>
<!-- ERROR 级别--> <!-- ERROR 级别-->
<root level="ERROR"> <!-- <root level="ERROR">-->
<!-- 按照每天生成日志文档 --> <!-- &lt;!&ndash; 按照每天生成日志文档 &ndash;&gt;-->
<appender-ref ref="INFO_FILE"/> <!-- <appender-ref ref="INFO_FILE"/>-->
<appender-ref ref="WARN_FILE"/> <!-- <appender-ref ref="WARN_FILE"/>-->
<appender-ref ref="ERROR_FILE"/> <!-- <appender-ref ref="ERROR_FILE"/>-->
<appender-ref ref="ALL_FILE"/> <!-- <appender-ref ref="ALL_FILE"/>-->
</root> <!-- </root>-->
</configuration> </configuration>

View File

@ -138,10 +138,11 @@ public class EntranceServiceImpl implements IEntranceService {
} }
JsonResultEntity jsonResultEntity; JsonResultEntity jsonResultEntity;
try { try {
//先注释掉观察调用的性能
// logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>请求的参数jsonObject" + jsonObject.toJSONString()); // logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>请求的参数jsonObject" + jsonObject.toJSONString());
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); // logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
jsonResultEntity = (JsonResultEntity) m.invoke(object, jsonObject); jsonResultEntity = (JsonResultEntity) m.invoke(object, jsonObject);
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); // logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
return jsonResultEntity; return jsonResultEntity;
} catch (Exception e) { } catch (Exception e) {
logger.error("METHOD doBusiness invokeException{}", e.getMessage()); logger.error("METHOD doBusiness invokeException{}", e.getMessage());