From 3042bf29bf2333d1d7c6980e536e67ba692875e0 Mon Sep 17 00:00:00 2001 From: Sunrisea <1336317033@qq.com> Date: Mon, 25 Nov 2024 17:19:11 +0800 Subject: [PATCH] log optimize --- .../server/model/ConfigCacheFactoryDelegate.java | 15 ++++++++++----- .../model/ConfigCachePostProcessorDelegate.java | 14 +++++++++++--- .../server/utils/Md5ComparatorDelegate.java | 8 +++++++- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCacheFactoryDelegate.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCacheFactoryDelegate.java index 8e7fa2e0a8..d8d431588a 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCacheFactoryDelegate.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCacheFactoryDelegate.java @@ -43,18 +43,23 @@ private ConfigCacheFactoryDelegate() { Collection configCacheFactories = NacosServiceLoader.load(ConfigCacheFactory.class); for (ConfigCacheFactory each : configCacheFactories) { if (StringUtils.isEmpty(each.getConfigCacheFactoryName())) { - LOGGER.warn("[ConfigCacheFactory] Load ConfigCacheFactory({}) ConfigFactroyName (null/empty) fail. " - + "Please add ConfigFactoryName to resolve", - each.getClass()); + LOGGER.warn( + "[ConfigCacheFactoryDelegate] Load ConfigCacheFactory({}) ConfigFactroyName (null/empty) fail. " + + "Please add ConfigFactoryName to resolve", each.getClass().getName()); continue; } - LOGGER.info("[ConfigCacheFactory] Load ConfigCacheFactory({}) ConfigCacheFactoryName({}) successfully. ", - each.getClass(), each.getConfigCacheFactoryName()); + LOGGER.info( + "[ConfigCacheFactoryDelegate] Load ConfigCacheFactory({}) ConfigCacheFactoryName({}) successfully. ", + each.getClass().getName(), each.getConfigCacheFactoryName()); if (StringUtils.equals(configCacheFactoryType, each.getConfigCacheFactoryName())) { + LOGGER.info("[ConfigCacheFactoryDelegate] Matched ConfigCacheFactory found,set configCacheFactory={}", + each.getClass().getName()); this.configCacheFactory = each; } } if (this.configCacheFactory == null) { + LOGGER.info( + "[ConfigCacheFactoryDelegate] Matched ConfigCacheFactory not found, Load Default NacosConfigCacheFactory successfully."); this.configCacheFactory = new NacosConfigCacheFactory(); } } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCachePostProcessorDelegate.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCachePostProcessorDelegate.java index 294ead7c34..414a53040b 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCachePostProcessorDelegate.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigCachePostProcessorDelegate.java @@ -44,16 +44,24 @@ private ConfigCachePostProcessorDelegate() { for (ConfigCachePostProcessor processor : processors) { if (StringUtils.isEmpty(processor.getPostProcessorName())) { LOGGER.warn( - "[ConfigCachePostProcessor] Load ConfigCachePostProcessor({}) PostProcessorName(null/empty) fail. " - + "Please add PostProcessorName to resolve", - processor.getClass().getName()); + "[ConfigCachePostProcessorDelegate] Load ConfigCachePostProcessor({}) PostProcessorName(null/empty) fail. " + + "Please add PostProcessorName to resolve", processor.getClass().getName()); continue; } + LOGGER.info( + "[ConfigCachePostProcessorDelegate] Load ConfigCachePostProcessor({}) PostProcessorName({}) successfully. ", + processor.getClass().getName(), processor.getPostProcessorName()); if (StringUtils.equals(configCacheMd5PostProcessorType, processor.getPostProcessorName())) { + LOGGER.info( + "[ConfigCachePostProcessorDelegate] Matched ConfigCachePostProcessor found,set configCacheFactory={}", + processor.getClass().getName()); this.configCachePostProcessor = processor; } } if (configCachePostProcessor == null) { + LOGGER.info( + "[ConfigCachePostProcessorDelegate] Matched ConfigCachePostProcessor not found, " + + "load Default NacosConfigCachePostProcessor successfully"); configCachePostProcessor = new NacosConfigCachePostProcessor(); } } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/utils/Md5ComparatorDelegate.java b/config/src/main/java/com/alibaba/nacos/config/server/utils/Md5ComparatorDelegate.java index 3eb4fcb585..ac666a4416 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/utils/Md5ComparatorDelegate.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/utils/Md5ComparatorDelegate.java @@ -48,15 +48,21 @@ private Md5ComparatorDelegate() { for (Md5Comparator each : md5Comparators) { if (StringUtils.isEmpty(each.getMd5ComparatorName())) { LOGGER.warn( - "[Md5Comparator] Load Md5Comparator({}) Md5ComparatorName(null/empty) fail. Please add Md5ComparatorName to resolve", + "[Md5ComparatorDelegate] Load Md5Comparator({}) Md5ComparatorName(null/empty) fail. Please add Md5ComparatorName to resolve", each.getClass().getName()); continue; } + LOGGER.info("[Md5ComparatorDelegate] Load Md5Comparator({}) Md5ComparatorName({}) successfully.", + each.getClass().getName(), each.getMd5ComparatorName()); if (StringUtils.equals(md5ComparatorType, each.getMd5ComparatorName())) { + LOGGER.info("[Md5ComparatorDelegate] Matched Md5Comparator found,set md5Comparator={}", + each.getClass().getName()); md5Comparator = each; } } if (md5Comparator == null) { + LOGGER.info( + "[Md5ComparatorDelegate] Matched Md5Comparator not found, load Default NacosMd5Comparator successfully"); md5Comparator = new NacosMd5Comparator(); } }