perf(webapp): 优化日志记录和性能监控

- 修改 SoSaleOutPluginInitializerToC 类,增加额外的 ReentrantLock 实例
- 更新 logback-spring.xml,注释掉部分日志 appender 引用
- 在 EntranceServiceImpl 中添加方法执行时间记录,以监控性能
This commit is contained in:
liuy 2024-10-28 14:14:24 +08:00
parent de245d4ec3
commit c48968af55
3 changed files with 8 additions and 3 deletions

View File

@ -61,7 +61,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(SoSaleOutPluginInitializerToC.class);
private static final ReentrantLock LOCK = new ReentrantLock(true);
private static final ReentrantLock LOCK1 = new ReentrantLock(true);
private static final ReentrantLock LOCK2 = new ReentrantLock(true);
private static final String PROD_FILED = "prod";
//

View File

@ -158,8 +158,8 @@
<appender-ref ref="CONSOLE"/>
<!-- 按照每天生成日志文档 -->
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
<!-- <appender-ref ref="WARN_FILE"/>-->
<!-- <appender-ref ref="ERROR_FILE"/>-->
<!-- <appender-ref ref="ALL_FILE"/>-->
</root>

View File

@ -141,7 +141,10 @@ public class EntranceServiceImpl implements IEntranceService {
//先注释掉观察调用的性能
// logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>请求的参数jsonObject" + jsonObject.toJSONString());
// logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
long startTime = System.currentTimeMillis();
jsonResultEntity = (JsonResultEntity) m.invoke(object, jsonObject);
long endTime = System.currentTimeMillis();
logger.info("invoke_time_consuming{}", (endTime - startTime));
// logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
return jsonResultEntity;
} catch (Exception e) {