فهرست منبع

增加日志中的耗时打印

15810770710@163.com 3 سال پیش
والد
کامیت
ef83ed8766
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      src/main/java/com/jkcredit/record/storage/service/impl/RecordStorageServiceImpl.java

+ 3 - 2
src/main/java/com/jkcredit/record/storage/service/impl/RecordStorageServiceImpl.java

@@ -55,11 +55,12 @@ public class RecordStorageServiceImpl implements RecordStorageService {
             monthResult.setId(id);
         }
         BulkResponse response = null;
+        long startTime = System.currentTimeMillis();
         try {
             //执行保存 index同步 indexAsync异步
             response = esRestClient.bulk(bulkRequest, RequestOptions.DEFAULT);
         } catch (IOException ioe) {
-            log.error("pushEsException:", ioe);
+            log.error("costTime:{},pushEsException:", (System.currentTimeMillis() - startTime), ioe);
         }
         // 发送es异常
         if (response == null) {
@@ -69,7 +70,7 @@ public class RecordStorageServiceImpl implements RecordStorageService {
             return responseObject;
         }
 
-        log.info("pushEsResult:{}", !response.hasFailures());
+        log.info("pushEsResult:{}, costTime:{}", !response.hasFailures(), (System.currentTimeMillis() - startTime));
         // 判断发送es是否存在失败
         if (response.hasFailures()) {
             log.error("pushEsError-errorCount:{}, errorMessage:{}",