This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new 43d48bd6ca Error code is managed with constants (#10549) (#10599)
43d48bd6ca is described below

commit 43d48bd6caf95f61f4e879a5be8b5560a55daee9
Author: cnjxzhao <[email protected]>
AuthorDate: Mon Sep 19 14:31:03 2022 +0800

    Error code is managed with constants (#10549) (#10599)
    
    * Add error code 5-2 ~ 5-20.
    
    * Error code is managed with constants (#10549)
    
    * Error code is managed with constants (#10549)
---
 .../org/apache/dubbo/rpc/cluster/RouterChain.java  |   8 +-
 .../rpc/cluster/directory/AbstractDirectory.java   |   3 +-
 .../rpc/cluster/directory/StaticDirectory.java     |   4 +-
 .../dubbo/rpc/cluster/merger/MergerFactory.java    |   4 +-
 .../router/condition/ConditionStateRouter.java     |  12 +-
 .../condition/config/ListenableStateRouter.java    |   4 +-
 .../router/mesh/route/MeshAppRuleListener.java     |   7 +-
 .../cluster/router/mesh/route/MeshRuleManager.java |   3 +-
 .../cluster/router/mesh/route/MeshRuleRouter.java  |   3 +-
 .../router/mesh/util/MeshRuleDispatcher.java       |   5 +-
 .../cluster/router/script/ScriptStateRouter.java   |   5 +-
 .../rpc/cluster/router/tag/TagStateRouter.java     |   8 +-
 .../cluster/support/AbstractClusterInvoker.java    |   5 +-
 .../cluster/support/BroadcastClusterInvoker.java   |   5 +-
 .../cluster/support/FailbackClusterInvoker.java    |  10 +-
 .../cluster/support/FailoverClusterInvoker.java    |   3 +-
 .../cluster/support/FailsafeClusterInvoker.java    |   4 +-
 .../support/wrapper/MockClusterInvoker.java        |   5 +-
 .../apache/dubbo/common/cache/FileCacheStore.java  |   4 +-
 .../dubbo/common/cache/FileCacheStoreFactory.java  |   6 +-
 .../apache/dubbo/common/config/Configuration.java  |   3 +-
 .../common/constants/LoggerCodeConstants.java      | 164 +++++++++++++++++++++
 .../threadpool/support/AbortPolicyWithReport.java  |   3 +-
 .../org/apache/dubbo/config/DubboShutdownHook.java |  10 +-
 .../org/apache/dubbo/config/ReferenceConfig.java   |  19 ++-
 .../org/apache/dubbo/config/ServiceConfig.java     |  17 ++-
 .../config/deploy/DefaultApplicationDeployer.java  |   8 +-
 .../dubbo/config/deploy/DefaultModuleDeployer.java |  17 ++-
 .../ConfigurableMetadataServiceExporter.java       |   3 +-
 .../dubbo/config/utils/ConfigValidationUtils.java  |   5 +-
 .../context/DubboDeployApplicationListener.java    |   3 +-
 .../config/spring/AbstractRegistryService.java     |   4 +-
 .../dubbo/config/spring/EmbeddedZooKeeper.java     |   4 +-
 .../support/apollo/ApolloDynamicConfiguration.java |   3 +-
 .../zookeeper/ZookeeperDynamicConfiguration.java   |   4 +-
 .../client/ReflectionBasedServiceDiscovery.java    |   4 +-
 .../client/ServiceDiscoveryRegistryDirectory.java  |   3 +-
 .../listener/ServiceInstancesChangedListener.java  |   3 +-
 .../ServiceInstanceHostPortCustomizer.java         |   4 +-
 .../StandardMetadataServiceURLBuilder.java         |   5 +-
 .../integration/AbstractConfiguratorListener.java  |   3 +-
 .../registry/integration/DynamicDirectory.java     |  13 +-
 .../registry/integration/RegistryDirectory.java    |  21 ++-
 .../dubbo/registry/retry/AbstractRetryTask.java    |   5 +-
 .../dubbo/registry/support/AbstractRegistry.java   |  28 ++--
 .../registry/support/AbstractRegistryFactory.java  |   3 +-
 .../support/CacheableFailbackRegistry.java         |  20 ++-
 .../dubbo/registry/support/RegistryManager.java    |   4 +-
 .../remoting/transport/netty/NettyClient.java      |   7 +-
 .../remoting/transport/netty4/NettyClient.java     |   6 +-
 .../curator5/Curator5ZookeeperClient.java          |   3 +-
 .../zookeeper/curator/CuratorZookeeperClient.java  |   3 +-
 52 files changed, 387 insertions(+), 123 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
index 0b91f518f7..64246b9ea5 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/RouterChain.java
@@ -43,6 +43,8 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_STOP;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_NO_VALID_PROVIDER;
 import static org.apache.dubbo.rpc.cluster.Constants.ROUTER_KEY;
 
 /**
@@ -297,7 +299,7 @@ public class RouterChain<T> {
                 if (routerSnapshotSwitcher.isEnable()) {
                     routerSnapshotSwitcher.setSnapshot(message);
                 }
-                logger.warn("2-2","No provider available after route for the 
service","",message);
+                logger.warn(CLUSTER_NO_VALID_PROVIDER,"No provider available 
after route for the service","",message);
             }
         } else {
             if (logger.isInfoEnabled()) {
@@ -345,7 +347,7 @@ public class RouterChain<T> {
             try {
                 router.stop();
             } catch (Exception e) {
-                logger.error("2-3","route stop failed","","Error trying to 
stop router " + router.getClass(),e);
+                logger.error(CLUSTER_FAILED_STOP,"route stop failed","","Error 
trying to stop router " + router.getClass(),e);
             }
         }
         routers = Collections.emptyList();
@@ -355,7 +357,7 @@ public class RouterChain<T> {
             try {
                 router.stop();
             } catch (Exception e) {
-                logger.error("2-3","StateRouter stop failed","","Error trying 
to stop StateRouter " + router.getClass(),e);
+                logger.error(CLUSTER_FAILED_STOP,"StateRouter stop 
failed","","Error trying to stop StateRouter " + router.getClass(),e);
             }
         }
         stateRouters = Collections.emptyList();
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
index fd2c4679bf..11e7e82fa4 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java
@@ -61,6 +61,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.RECONNECT_TASK_PERIOD;
 import static 
org.apache.dubbo.common.constants.CommonConstants.RECONNECT_TASK_TRY_COUNT;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REGISTER_IP_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_NO_VALID_PROVIDER;
 import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;
 import static org.apache.dubbo.rpc.cluster.Constants.CONSUMER_URL_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
@@ -195,7 +196,7 @@ public abstract class AbstractDirectory<T> implements 
Directory<T> {
         if (routedResult.isEmpty()) {
             // 2-2 - No provider available.
 
-            logger.warn("2-2", "provider server or registry center crashed", 
"",
+            logger.warn(CLUSTER_NO_VALID_PROVIDER, "provider server or 
registry center crashed", "",
                 "No provider available after connectivity filter for the 
service " + getConsumerUrl().getServiceKey()
                 + " All validInvokers' size: " + validInvokers.size()
                 + " All routed invokers' size: " + routedResult.size()
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java
index cc35d2cbff..106e997c87 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectory.java
@@ -28,6 +28,8 @@ import org.apache.dubbo.rpc.cluster.router.state.BitList;
 
 import java.util.List;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_SITE_SELECTION;
+
 /**
  * StaticDirectory
  */
@@ -108,7 +110,7 @@ public class StaticDirectory<T> extends 
AbstractDirectory<T> {
                 List<Invoker<T>> finalInvokers = 
routerChain.route(getConsumerUrl(), invokers, invocation);
                 return finalInvokers == null ? BitList.emptyList() : 
finalInvokers;
             } catch (Throwable t) {
-                logger.error("2-1","Failed to execute router","","Failed to 
execute router: " + getUrl() + ", cause: " + t.getMessage(),t);
+                logger.error(CLUSTER_FAILED_SITE_SELECTION,"Failed to execute 
router","","Failed to execute router: " + getUrl() + ", cause: " + 
t.getMessage(),t);
                 return BitList.emptyList();
             }
         }
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java
index fddf67625c..038e38f2b0 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/merger/MergerFactory.java
@@ -31,6 +31,8 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_LOAD_MERGER;
+
 public class MergerFactory implements ScopeModelAware {
 
     private static final ErrorTypeAwareLogger logger = 
LoggerFactory.getErrorTypeAwareLogger(MergerFactory.class);
@@ -73,7 +75,7 @@ public class MergerFactory implements ScopeModelAware {
             Merger m = 
scopeModel.getExtensionLoader(Merger.class).getExtension(name);
             Class<?> actualTypeArg = getActualTypeArgument(m.getClass());
             if (actualTypeArg == null) {
-                logger.warn("2-4","load merger config failed","","Failed to 
get actual type argument from merger " + m.getClass().getName());
+                logger.warn(CLUSTER_FAILED_LOAD_MERGER,"load merger config 
failed","","Failed to get actual type argument from merger " + 
m.getClass().getName());
                 continue;
             }
             MERGER_CACHE.putIfAbsent(actualTypeArg, m);
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouter.java
index 5bd3bebe6f..be4774e429 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionStateRouter.java
@@ -45,6 +45,8 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.ENABLED_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.HOST_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.METHOD_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_CONDITIONAL_ROUTE_LIST_EMPTY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_EXEC_CONDITION_ROUTER;
 import static org.apache.dubbo.rpc.cluster.Constants.ADDRESS_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY;
@@ -54,7 +56,7 @@ import static 
org.apache.dubbo.rpc.cluster.Constants.RUNTIME_KEY;
  * ConditionRouter
  * It supports the conditional routing configured by "override://", in 2.6.x,
  * refer to https://dubbo.apache.org/en/docs/v2.7/user/examples/routing-rule/ .
- * For 2.7.x and later, please refer to {@link 
org.apache.dubbo.rpc.cluster.router.condition.config.ServiceRouter}
+ * For 2.7.x and later, please refer to {@link 
org.apache.dubbo.rpc.cluster.router.condition.config.ServiceStateRouter}
  * and {@link AppStateRouter}
  * refer to https://dubbo.apache.org/zh/docs/v2.7/user/examples/routing-rule/ .
  */
@@ -202,7 +204,7 @@ public class ConditionStateRouter<T> extends 
AbstractStateRouter<T> {
                 return invokers;
             }
             if (thenCondition == null) {
-                logger.warn("2-6","condition state router thenCondition is 
empt","","The current consumer in the service blacklist. consumer: " + 
NetUtils.getLocalHost() + ", service: " + url.getServiceKey());                
if (needToPrintMessage) {
+                logger.warn(CLUSTER_CONDITIONAL_ROUTE_LIST_EMPTY,"condition 
state router thenCondition is empty","","The current consumer in the service 
blacklist. consumer: " + NetUtils.getLocalHost() + ", service: " + 
url.getServiceKey());                if (needToPrintMessage) {
                     messageHolder.set("Empty return. Reason: ThenCondition is 
empty.");
                 }
                 return BitList.emptyList();
@@ -216,14 +218,14 @@ public class ConditionStateRouter<T> extends 
AbstractStateRouter<T> {
                 }
                 return result;
             } else if (this.isForce()) {
-                logger.warn("2-6","execute condition state router result list 
is empty. and force=true","","The route result is empty and force execute. 
consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey() + 
", router: " + url.getParameterAndDecoded(RULE_KEY));
+                logger.warn(CLUSTER_CONDITIONAL_ROUTE_LIST_EMPTY,"execute 
condition state router result list is empty. and force=true","","The route 
result is empty and force execute. consumer: " + NetUtils.getLocalHost() + ", 
service: " + url.getServiceKey() + ", router: " + 
url.getParameterAndDecoded(RULE_KEY));
                 if (needToPrintMessage) {
                     messageHolder.set("Empty return. Reason: Empty result from 
condition and condition is force.");
                 }
                 return result;
             }
         } catch (Throwable t) {
-            logger.error("2-7","execute condition state router 
exception","","Failed to execute condition router rule: " + getUrl() + ", 
invokers: " + invokers + ", cause: " + t.getMessage(),t);
+            logger.error(CLUSTER_FAILED_EXEC_CONDITION_ROUTER,"execute 
condition state router exception","","Failed to execute condition router rule: 
" + getUrl() + ", invokers: " + invokers + ", cause: " + t.getMessage(),t);
         }
         if (needToPrintMessage) {
             messageHolder.set("Directly return. Reason: Error occurred ( or 
result is empty ).");
@@ -323,7 +325,7 @@ public class ConditionStateRouter<T> extends 
AbstractStateRouter<T> {
                 return true;
             }
         } catch (Exception e) {
-            logger.warn("2-7","condition state router arguments match 
failed","","Arguments match failed, matchPair[]" + matchPair + "] invocation[" 
+ invocation + "]",e);
+            logger.warn(CLUSTER_FAILED_EXEC_CONDITION_ROUTER,"condition state 
router arguments match failed","","Arguments match failed, matchPair[]" + 
matchPair + "] invocation[" + invocation + "]",e);
         }
 
         return false;
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ListenableStateRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ListenableStateRouter.java
index ff6af3c467..2348a3e23c 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ListenableStateRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/config/ListenableStateRouter.java
@@ -41,6 +41,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_RULE_PARSING;
+
 /**
  * Abstract router which listens to dynamic configuration
  */
@@ -75,7 +77,7 @@ public abstract class ListenableStateRouter<T> extends 
AbstractStateRouter<T> im
                 routerRule = ConditionRuleParser.parse(event.getContent());
                 generateConditions(routerRule);
             } catch (Exception e) {
-                logger.error("2-15","Failed to parse the raw condition 
rule","","Failed to parse the raw condition rule and it will not take effect, 
please check " +
+                logger.error(CLUSTER_FAILED_RULE_PARSING,"Failed to parse the 
raw condition rule","","Failed to parse the raw condition rule and it will not 
take effect, please check " +
                     "if the condition rule matches with the template, the raw 
rule is:\n " + event.getContent(),e);
             }
         }
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListener.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListener.java
index 8116c0dfe2..b6332e4485 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListener.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshAppRuleListener.java
@@ -36,6 +36,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_RECEIVE_RULE;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.METADATA_KEY;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.NAME_KEY;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.STANDARD_ROUTER_KEY;
@@ -78,17 +79,17 @@ public class MeshAppRuleListener implements 
ConfigurationListener {
                     if (ruleType != null) {
                         groupMap.computeIfAbsent(ruleType, (k)-> new 
LinkedList<>()).add(resultMap);
                     } else {
-                        logger.error("2-13","receive mesh app route rule is 
invalid","","Unable to get rule type from raw rule. " +
+                        logger.error(CLUSTER_FAILED_RECEIVE_RULE,"receive mesh 
app route rule is invalid","","Unable to get rule type from raw rule. " +
                             "Probably the metadata.name is absent. App Name: " 
+ appName + " RawRule: " + configInfo);
                     }
                 } else {
-                    logger.error("2-13","receive mesh app route rule is 
invalid","","Rule format is unacceptable. App Name: " + appName + " RawRule: " 
+ configInfo);
+                    logger.error(CLUSTER_FAILED_RECEIVE_RULE,"receive mesh app 
route rule is invalid","","Rule format is unacceptable. App Name: " + appName + 
" RawRule: " + configInfo);
                 }
             }
 
             ruleMapHolder = groupMap;
         } catch (Exception e) {
-            logger.error("2-13","failed to receive mesh app route 
rule","","[MeshAppRule] parse failed: " + configInfo,e);
+            logger.error(CLUSTER_FAILED_RECEIVE_RULE,"failed to receive mesh 
app route rule","","[MeshAppRule] parse failed: " + configInfo,e);
         }
         if (ruleMapHolder != null) {
             meshRuleDispatcher.post(ruleMapHolder);
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
index 8caa5b75ca..ac494757fb 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
@@ -29,6 +29,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_RECEIVE_RULE;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.MESH_RULE_DATA_ID_SUFFIX;
 
 public class MeshRuleManager {
@@ -63,7 +64,7 @@ public class MeshRuleManager {
                 meshAppRuleListener.receiveConfigInfo(rawConfig);
             }
         } catch (Throwable throwable) {
-            logger.error("2-13","failed to get mesh app route rule","","get 
MeshRuleManager app rule failed.",throwable);
+            logger.error(CLUSTER_FAILED_RECEIVE_RULE,"failed to get mesh app 
route rule","","get MeshRuleManager app rule failed.",throwable);
         }
 
         ruleRepository.addListener(appRuleDataId, 
DynamicConfiguration.DEFAULT_GROUP, meshAppRuleListener);
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouter.java
index 2469c3a758..0d3d8b56dd 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleRouter.java
@@ -51,6 +51,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ThreadLocalRandom;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_RECEIVE_RULE;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.DESTINATION_RULE_KEY;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.INVALID_APP_NAME;
 import static 
org.apache.dubbo.rpc.cluster.router.mesh.route.MeshRuleConstants.KIND_KEY;
@@ -308,7 +309,7 @@ public abstract class MeshRuleRouter<T> extends 
AbstractStateRouter<T> implement
                 appToVDGroup.put(appName, vsDestinationGroup);
             }
         } catch (Throwable t) {
-            logger.error("2-13","failed to parse mesh route rule","","Error 
occurred when parsing rule component.",t);
+            logger.error(CLUSTER_FAILED_RECEIVE_RULE,"failed to parse mesh 
route rule","","Error occurred when parsing rule component.",t);
         }
 
         computeSubset(appToVDGroup);
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcher.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcher.java
index 7666da472c..03f68ddbab 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcher.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/util/MeshRuleDispatcher.java
@@ -27,6 +27,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_NO_RULE_LISTENER;
+
 
 public class MeshRuleDispatcher {
     private static final ErrorTypeAwareLogger logger = 
LoggerFactory.getErrorTypeAwareLogger(MeshRuleDispatcher.class);
@@ -55,8 +57,7 @@ public class MeshRuleDispatcher {
                         listener.onRuleChange(appName, entry.getValue());
                     }
                 } else {
-                    logger.warn("2-18","Receive mesh rule but none of listener 
has been registered","","Receive rule but none of listener has been registered. 
Maybe type not matched. Rule Type: " + ruleType);
-                    logger.warn("Receive rule but none of listener has been 
registered. Maybe type not matched. Rule Type: " + ruleType);
+                    logger.warn(CLUSTER_NO_RULE_LISTENER,"Receive mesh rule 
but none of listener has been registered","","Receive rule but none of listener 
has been registered. Maybe type not matched. Rule Type: " + ruleType);
                 }
             }
             // clear rule listener not being notified in this time
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouter.java
index bcc0cc7b67..174ecb9e0d 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptStateRouter.java
@@ -49,6 +49,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_SCRIPT_EXCEPTION;
 import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_SCRIPT_TYPE_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY;
@@ -92,7 +93,7 @@ public class ScriptStateRouter<T> extends 
AbstractStateRouter<T> {
             Compilable compilable = (Compilable) engine;
             function = compilable.compile(rule);
         } catch (ScriptException e) {
-            logger.error("2-15","script route rule invalid","","script route 
error, rule has been ignored. rule: " + rule +
+            logger.error(CLUSTER_SCRIPT_EXCEPTION,"script route rule 
invalid","","script route error, rule has been ignored. rule: " + rule +
                 ", url: " + RpcContext.getServiceContext().getUrl(),e);
         }
     }
@@ -136,7 +137,7 @@ public class ScriptStateRouter<T> extends 
AbstractStateRouter<T> {
             try {
                 return function.eval(bindings);
             } catch (ScriptException e) {
-                logger.error("2-15","Scriptrouter exec script 
error","","Script route error, rule has been ignored. rule: " + rule + ", 
method:" +
+                logger.error(CLUSTER_SCRIPT_EXCEPTION,"Scriptrouter exec 
script error","","Script route error, rule has been ignored. rule: " + rule + 
", method:" +
                     invocation.getMethodName() + ", url: " + 
RpcContext.getContext().getUrl(),e);
                 return invokers;
             }
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouter.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouter.java
index 9b76a1d28b..20aee26407 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouter.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagStateRouter.java
@@ -41,6 +41,8 @@ import java.util.function.Predicate;
 
 import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
 import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_TAG_ROUTE_EMPTY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_TAG_ROUTE_INVALID;
 import static org.apache.dubbo.rpc.Constants.FORCE_USE_TAG;
 
 /**
@@ -72,7 +74,7 @@ public class TagStateRouter<T> extends AbstractStateRouter<T> 
implements Configu
                 this.tagRouterRule = TagRuleParser.parse(event.getContent());
             }
         } catch (Exception e) {
-            logger.error("2-11","Failed to parse the raw tag router 
rule","","Failed to parse the raw tag router rule and it will not take effect, 
please check if the " +
+            logger.error(CLUSTER_TAG_ROUTE_INVALID,"Failed to parse the raw 
tag router rule","","Failed to parse the raw tag router rule and it will not 
take effect, please check if the " +
                 "rule matches with the template, the raw rule is:\n ",e);
         }
     }
@@ -235,7 +237,7 @@ public class TagStateRouter<T> extends 
AbstractStateRouter<T> implements Configu
                     return true;
                 }
             } catch (Exception e) {
-                logger.error("2-11","tag route address is invalid","","The 
format of ip address is invalid in tag route. Address :" + address,e);
+                logger.error(CLUSTER_TAG_ROUTE_INVALID,"tag route address is 
invalid","","The format of ip address is invalid in tag route. Address :" + 
address,e);
             }
         }
         return false;
@@ -256,7 +258,7 @@ public class TagStateRouter<T> extends 
AbstractStateRouter<T> implements Configu
         String providerApplication = url.getRemoteApplication();
 
         if (StringUtils.isEmpty(providerApplication)) {
-            logger.error("2-12","tag router get providerApplication is 
empty","","TagRouter must getConfig from or subscribe to a specific 
application, but the application " +
+            logger.error(CLUSTER_TAG_ROUTE_EMPTY,"tag router get 
providerApplication is empty","","TagRouter must getConfig from or subscribe to 
a specific application, but the application " +
                 "in this TagRouter is not specified.");
             return;
         }
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
index 8f13c7a964..c4435a44c6 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java
@@ -49,6 +49,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_RESELECT
 import static 
org.apache.dubbo.common.constants.CommonConstants.ENABLE_CONNECTIVITY_VALIDATION;
 import static 
org.apache.dubbo.common.constants.CommonConstants.LOADBALANCE_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.RESELECT_COUNT;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_RESELECT_INVOKERS;
 import static 
org.apache.dubbo.rpc.cluster.Constants.CLUSTER_AVAILABLE_CHECK_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY;
 import static 
org.apache.dubbo.rpc.cluster.Constants.DEFAULT_CLUSTER_AVAILABLE_CHECK;
@@ -213,11 +214,11 @@ public abstract class AbstractClusterInvoker<T> 
implements ClusterInvoker<T> {
                         //Avoid collision
                         invoker = invokers.get((index + 1) % invokers.size());
                     } catch (Exception e) {
-                        logger.warn("2-5","select invokers 
exception","",e.getMessage() + " may because invokers list dynamic change, 
ignore.",e);
+                        logger.warn(CLUSTER_FAILED_RESELECT_INVOKERS,"select 
invokers exception","",e.getMessage() + " may because invokers list dynamic 
change, ignore.",e);
                     }
                 }
             } catch (Throwable t) {
-                logger.error("2-5","failed to reselect invokers","","cluster 
reselect fail reason is :" + t.getMessage() + " if can not solve, you can set 
cluster.availablecheck=false in url",t);
+                logger.error(CLUSTER_FAILED_RESELECT_INVOKERS,"failed to 
reselect invokers","","cluster reselect fail reason is :" + t.getMessage() + " 
if can not solve, you can set cluster.availablecheck=false in url",t);
             }
         }
 
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/BroadcastClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/BroadcastClusterInvoker.java
index f44035a6a4..a9d52467f9 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/BroadcastClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/BroadcastClusterInvoker.java
@@ -30,6 +30,7 @@ import org.apache.dubbo.rpc.cluster.LoadBalance;
 
 import java.util.List;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_ERROR_RESPONSE;
 import static org.apache.dubbo.rpc.Constants.ASYNC_KEY;
 
 /**
@@ -76,7 +77,7 @@ public class BroadcastClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
                     Throwable resultException = result.getException();
                     if (null != resultException) {
                         exception = getRpcException(result.getException());
-                        logger.warn("2-8","provider return error 
response","",exception.getMessage(),exception);
+                        logger.warn(CLUSTER_ERROR_RESPONSE,"provider return 
error response","",exception.getMessage(),exception);
                         failIndex++;
                         if (failIndex == failThresholdIndex) {
                             break;
@@ -85,7 +86,7 @@ public class BroadcastClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
                 }
             } catch (Throwable e) {
                 exception = getRpcException(e);
-                logger.warn("2-8","provider return error 
response","",exception.getMessage(),exception);
+                logger.warn(CLUSTER_ERROR_RESPONSE,"provider return error 
response","",exception.getMessage(),exception);
                 failIndex++;
                 if (failIndex == failThresholdIndex) {
                     break;
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java
index db158c7133..608b00ef1f 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java
@@ -39,6 +39,8 @@ import java.util.concurrent.TimeUnit;
 
 import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_FAILBACK_TIMES;
 import static org.apache.dubbo.common.constants.CommonConstants.RETRIES_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_INVOKE_SERVICE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_TIMER_RETRY_FAILED;
 import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_FAILBACK_TASKS;
 import static org.apache.dubbo.rpc.cluster.Constants.FAIL_BACK_TASKS_KEY;
 
@@ -93,7 +95,7 @@ public class FailbackClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
         try {
             failTimer.newTimeout(retryTimerTask, RETRY_FAILED_PERIOD, 
TimeUnit.SECONDS);
         } catch (Throwable e) {
-            logger.error("2-9","add newTimeout exception","","Failback 
background works error, invocation->" + invocation + ", exception: " + 
e.getMessage(),e);
+            logger.error(CLUSTER_TIMER_RETRY_FAILED,"add newTimeout 
exception","","Failback background works error, invocation->" + invocation + ", 
exception: " + e.getMessage(),e);
         }
     }
 
@@ -108,7 +110,7 @@ public class FailbackClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
             // Then the serviceContext will be cleared after the call is 
completed.
             return invokeWithContextAsync(invoker, invocation, consumerUrl);
         } catch (Throwable e) {
-            logger.error("2-10","Failback to invoke method and start to 
retries","","Failback to invoke method " + invocation.getMethodName() + ", wait 
for retry in background. Ignored exception: "
+            logger.error(CLUSTER_FAILED_INVOKE_SERVICE,"Failback to invoke 
method and start to retries","","Failback to invoke method " + 
invocation.getMethodName() + ", wait for retry in background. Ignored 
exception: "
                 + e.getMessage() + ", ",e);
             if (retries > 0) {
                 addFailed(loadbalance, invocation, invokers, invoker, 
consumerUrl);
@@ -166,9 +168,9 @@ public class FailbackClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
                 lastInvoker = retryInvoker;
                 invokeWithContextAsync(retryInvoker, invocation, consumerUrl);
             } catch (Throwable e) {
-                logger.error("2-10","Failed retry to invoke method","","Failed 
retry to invoke method " + invocation.getMethodName() + ", waiting again.",e);
+                logger.error(CLUSTER_FAILED_INVOKE_SERVICE,"Failed retry to 
invoke method","","Failed retry to invoke method " + invocation.getMethodName() 
+ ", waiting again.",e);
                 if ((++retriedTimes) >= retries) {
-                    logger.error("2-10","Failed retry to invoke method and 
retry times exceed threshold","","Failed retry times exceed threshold (" + 
retries + "), We have to abandon, invocation->" + invocation,e);
+                    logger.error(CLUSTER_FAILED_INVOKE_SERVICE,"Failed retry 
to invoke method and retry times exceed threshold","","Failed retry times 
exceed threshold (" + retries + "), We have to abandon, invocation->" + 
invocation,e);
                 } else {
                     rePut(timeout);
                 }
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java
index 12cee0474d..18583742ba 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java
@@ -36,6 +36,7 @@ import java.util.Set;
 
 import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_RETRIES;
 import static org.apache.dubbo.common.constants.CommonConstants.RETRIES_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_MULTIPLE_RETRIES;
 
 /**
  * When invoke fails, log the initial error and retry other invokers (retry n 
times, which means at most n different invokers will be invoked)
@@ -79,7 +80,7 @@ public class FailoverClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
             try {
                 Result result = invokeWithContext(invoker, invocation);
                 if (le != null && logger.isWarnEnabled()) {
-                    logger.warn("2-16","failed to retry do 
invoke","","Although retry the method " + methodName
+                    logger.warn(CLUSTER_FAILED_MULTIPLE_RETRIES,"failed to 
retry do invoke","","Although retry the method " + methodName
                         + " in the service " + getInterface().getName()
                         + " was successful by the provider " + 
invoker.getUrl().getAddress()
                         + ", but there have been failed providers " + providers
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
index 33aa5d09ed..c09205bdbd 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailsafeClusterInvoker.java
@@ -28,6 +28,8 @@ import org.apache.dubbo.rpc.cluster.LoadBalance;
 
 import java.util.List;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_ERROR_RESPONSE;
+
 /**
  * When invoke fails, log the error message and ignore this error by returning 
an empty Result.
  * Usually used to write audit logs and other operations
@@ -49,7 +51,7 @@ public class FailsafeClusterInvoker<T> extends 
AbstractClusterInvoker<T> {
             Invoker<T> invoker = select(loadbalance, invocation, invokers, 
null);
             return invokeWithContext(invoker, invocation);
         } catch (Throwable e) {
-            logger.error("2-8","Failsafe for provider exception","","Failsafe 
ignore exception: " + e.getMessage(),e);
+            logger.error(CLUSTER_ERROR_RESPONSE,"Failsafe for provider 
exception","","Failsafe ignore exception: " + e.getMessage(),e);
             return AsyncRpcResult.newDefaultAsyncResult(null, null, 
invocation); // ignore
         }
     }
diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
index ec2596dd98..a935fd95ea 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java
@@ -39,6 +39,7 @@ import org.apache.dubbo.rpc.support.RpcUtils;
 
 import java.util.List;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_MOCK_REQUEST;
 import static org.apache.dubbo.rpc.Constants.MOCK_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK;
@@ -102,7 +103,7 @@ public class MockClusterInvoker<T> implements 
ClusterInvoker<T> {
             result = this.invoker.invoke(invocation);
         } else if (value.startsWith(FORCE_KEY)) {
             if (logger.isWarnEnabled()) {
-                logger.warn("2-17","force mock","","force-mock: " + 
invocation.getMethodName() + " force-mock enabled , url : " + getUrl());
+                logger.warn(CLUSTER_FAILED_MOCK_REQUEST,"force 
mock","","force-mock: " + invocation.getMethodName() + " force-mock enabled , 
url : " + getUrl());
             }
             //force:direct mock
             result = doMockInvoke(invocation, null);
@@ -127,7 +128,7 @@ public class MockClusterInvoker<T> implements 
ClusterInvoker<T> {
                 }
 
                 if (logger.isWarnEnabled()) {
-                    logger.warn("2-17","failed to mock invoke","","fail-mock: 
" + invocation.getMethodName() + " fail-mock enabled , url : " + getUrl(),e);
+                    logger.warn(CLUSTER_FAILED_MOCK_REQUEST,"failed to mock 
invoke","","fail-mock: " + invocation.getMethodName() + " fail-mock enabled , 
url : " + getUrl(),e);
                 }
                 result = doMockInvoke(invocation, e);
             }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStore.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStore.java
index db4625f5e4..b3a3bc9ef2 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStore.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStore.java
@@ -37,6 +37,8 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_CACHE_FILE_EXCEED_MAXIMUM_LIMIT;
+
 /**
  * Local file interaction class that can back different caches.
  * <p>
@@ -73,7 +75,7 @@ public class FileCacheStore {
             }
 
             if (count > entrySize) {
-                logger.warn("0-4", "mis-configuration of system properties",
+                logger.warn(COMMON_CACHE_FILE_EXCEED_MAXIMUM_LIMIT, 
"mis-configuration of system properties",
                     "Check Java system property 
'dubbo.mapping.cache.entrySize' and 'dubbo.meta.cache.entrySize'.",
                     "Cache file was truncated for exceeding the maximum entry 
size: " + entrySize);
             }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
index ca88d74652..5710b5339c 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
@@ -34,6 +34,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_CACHE_PATH_INACCESSIBLE;
+
 /**
  * ClassLoader Level static share.
  * Prevent FileCacheStore being operated in multi-application
@@ -92,7 +94,7 @@ public final class FileCacheStoreFactory {
             } catch (IOException e) {
                 // 0-3 - cache path inaccessible
 
-                logger.error("0-3", "inaccessible of cache path", "",
+                logger.error(COMMON_CACHE_PATH_INACCESSIBLE, "inaccessible of 
cache path", "",
                     "Cache store path can't be created: ", e);
 
                 throw new RuntimeException("Cache store path can't be created: 
" + candidate, e);
@@ -157,7 +159,7 @@ public final class FileCacheStoreFactory {
             return builder.build();
         } catch (Throwable t) {
 
-            logger.warn("0-3", "inaccessible of cache path", "",
+            logger.warn(COMMON_CACHE_PATH_INACCESSIBLE, "inaccessible of cache 
path", "",
                 "Failed to create file store cache. Local file cache will be 
disabled. Cache file name: " + name, t);
 
             return FileCacheStore.Empty.getInstance(name);
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java
index 50e65ddd8c..5c3988ab02 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java
@@ -22,6 +22,7 @@ import org.apache.dubbo.common.logger.LoggerFactory;
 import java.util.NoSuchElementException;
 
 import static org.apache.dubbo.common.config.ConfigurationUtils.isEmptyValue;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_PROPERTY_MISSPELLING;
 
 /**
  * Configuration interface, to fetch the value for the specified key.
@@ -73,7 +74,7 @@ public interface Configuration {
             return convert(Integer.class, key, defaultValue);
         } catch (NumberFormatException e) {
             // 0-2 Property type mismatch.
-            interfaceLevelLogger.error("0-2", "typo in property value",
+            interfaceLevelLogger.error(COMMON_PROPERTY_MISSPELLING, "typo in 
property value",
                 "This property requires an integer value.",
                 "Actual Class: " + getClass().getName(), e);
 
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java
new file mode 100644
index 0000000000..a508f1ae93
--- /dev/null
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+/**
+ * constants for logger
+ */
+public interface LoggerCodeConstants {
+
+    // common module 0-1 ~ 0-4
+    String COMMON_THREAD_POOL_EXHAUSTED = "0-1";
+
+    String COMMON_PROPERTY_MISSPELLING = "0-2";
+
+    String COMMON_CACHE_PATH_INACCESSIBLE = "0-3";
+
+    String COMMON_CACHE_FILE_EXCEED_MAXIMUM_LIMIT = "0-4";
+
+    // registry module
+    String REGISTRY_ADDRESS_INVALID = "1-1";
+
+    String REGISTRY_ABSENCE = "1-2";
+
+    String REGISTRY_FAILED_URL_EVICTING = "1-3";
+
+    String REGISTRY_EMPTY_ADDRESS = "1-4";
+
+    String REGISTRY_NO_PARAMETERS_URL = "1-5";
+
+    String REGISTRY_FAILED_CLEAR_CACHED_URLS = "1-6";
+
+    String REGISTRY_FAILED_NOTIFY_EVENT = "1-7";
+
+    String REGISTRY_FAILED_DESTROY_UNREGISTER_URL = "1-8";
+
+    String REGISTRY_FAILED_READ_WRITE_CACHE_FILE = "1-9";
+
+    String REGISTRY_FAILED_DELETE_LOCKFILE = "1-10";
+
+    String REGISTRY_FAILED_CREATE_INSTANCE = "1-11";
+
+    String REGISTRY_FAILED_FETCH_INSTANCE = "1-12";
+
+    String REGISTRY_EXECUTE_RETRYING_TASK = "1-13";
+
+    String REGISTRY_FAILED_PARSE_DYNAMIC_CONFIG = "1-14";
+
+    String REGISTRY_FAILED_DESTROY_SERVICE = "1-15";
+
+    String REGISTRY_UNSUPPORTED_CATEGORY = "1-16";
+
+    String REGISTRY_FAILED_REFRESH_ADDRESS = "1-17";
+
+    String REGISTRY_MISSING_METADATA_CONFIG_PORT = "1-18";
+
+    // cluster module 2-1 ~ 2-18
+    String CLUSTER_FAILED_SITE_SELECTION = "2-1";
+
+    String CLUSTER_NO_VALID_PROVIDER = "2-2";
+
+    String CLUSTER_FAILED_STOP = "2-3";
+
+    String CLUSTER_FAILED_LOAD_MERGER = "2-4";
+
+    String CLUSTER_FAILED_RESELECT_INVOKERS = "2-5";
+
+    String CLUSTER_CONDITIONAL_ROUTE_LIST_EMPTY = "2-6";
+
+    String CLUSTER_FAILED_EXEC_CONDITION_ROUTER = "2-7";
+
+    String CLUSTER_ERROR_RESPONSE = "2-8";
+
+    String CLUSTER_TIMER_RETRY_FAILED = "2-9";
+
+    String CLUSTER_FAILED_INVOKE_SERVICE = "2-10";
+
+    String CLUSTER_TAG_ROUTE_INVALID = "2-11";
+
+    String CLUSTER_TAG_ROUTE_EMPTY = "2-12";
+
+    String CLUSTER_FAILED_RECEIVE_RULE = "2-13";
+
+    String CLUSTER_SCRIPT_EXCEPTION = "2-14";
+
+    String CLUSTER_FAILED_RULE_PARSING = "2-15";
+
+    String CLUSTER_FAILED_MULTIPLE_RETRIES = "2-16";
+
+    String CLUSTER_FAILED_MOCK_REQUEST = "2-17";
+
+    String CLUSTER_NO_RULE_LISTENER = "2-18";
+
+    // proxy module 3-1
+    String PROXY_FAILED_CONVERT_URL = "3-1";
+
+    // protocol module 4-1 ~ 4-3
+    String PROTOCOL_UNSUPPORTED = "4-1";
+
+    String PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER = "4-2";
+
+    String PROTOCOL_FAILED_REFER_INVOKER = "4-3";
+
+    // config module 5-1 ~ 5-20
+    String CONFIG_FAILED_CONNECT_REGISTRY = "5-1";
+
+    String CONFIG_FAILED_SHUTDOWN_HOOK = "5-2";
+
+    String CONFIG_FAILED_DESTROY_INVOKER = "5-3";
+
+    String CONFIG_NO_METHOD_FOUND = "5-4";
+
+    String CONFIG_FAILED_LOAD_ENV_VARIABLE = "5-5";
+
+    String CONFIG_PROPERTY_CONFLICT = "5-6";
+
+    String CONFIG_UNEXPORT_ERROR = "5-7";
+
+    String CONFIG_USE_RANDOM_PORT = "5-8";
+
+    String CONFIG_FAILED_EXPORT_SERVICE = "5-9";
+
+    String CONFIG_SERVER_DISCONNECTED = "5-10";
+
+    String CONFIG_REGISTER_INSTANCE_ERROR = "5-11";
+
+    String CONFIG_REFRESH_INSTANCE_ERROR = "5-12";
+
+    String CONFIG_UNABLE_DESTROY_MODEL = "5-13";
+
+    String CONFIG_FAILED_START_MODEL = "5-14";
+
+    String CONFIG_FAILED_REFERENCE_MODEL = "5-15";
+
+    String CONFIG_FAILED_FIND_PROTOCOL = "5-16";
+
+    String CONFIG_PARAMETER_FORMAT_ERROR = "5-17";
+
+    String CONFIG_FAILED_NOTIFY_EVENT = "5-18";
+
+    String CONFIG_ZOOKEEPER_SERVER_ERROR = "5-19";
+
+    String CONFIG_STOP_DUBBO_ERROR = "5-20";
+
+    // transport module 6-1 ~ 6-2
+    String TRANSPORT_FAILED_CONNECT_PROVIDER = "6-1";
+
+    String TRANSPORT_CLIENT_CONNECT_TIMEOUT = "6-2";
+
+}
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java
index bd1578539c..43520f9fa7 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/AbortPolicyWithReport.java
@@ -41,6 +41,7 @@ import static java.lang.String.format;
 import static org.apache.dubbo.common.constants.CommonConstants.DUMP_DIRECTORY;
 import static org.apache.dubbo.common.constants.CommonConstants.OS_NAME_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.OS_WIN_PREFIX;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_THREAD_POOL_EXHAUSTED;
 
 /**
  * Abort Policy.
@@ -85,7 +86,7 @@ public class AbortPolicyWithReport extends 
ThreadPoolExecutor.AbortPolicy {
                 url.getProtocol(), url.getIp(), url.getPort());
 
         // 0-1 - Thread pool is EXHAUSTED!
-        logger.warn("0-1", "too much client requesting provider", "", msg);
+        logger.warn(COMMON_THREAD_POOL_EXHAUSTED, "too much client requesting 
provider", "", msg);
 
         dumpJStack();
         dispatchThreadPoolExhaustedEvent(msg);
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
index 3205413b07..6e023d391f 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/DubboShutdownHook.java
@@ -25,6 +25,8 @@ import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_SHUTDOWN_HOOK;
+
 /**
  * The shutdown hook thread to do the cleanup stuff.
  * This is a singleton in order to ensure there is only one shutdown hook 
registered.
@@ -86,9 +88,9 @@ public class DubboShutdownHook extends Thread {
             try {
                 Runtime.getRuntime().addShutdownHook(this);
             } catch (IllegalStateException e) {
-                logger.warn("5-2", "", "", "register shutdown hook failed: " + 
e.getMessage(), e);
+                logger.warn(CONFIG_FAILED_SHUTDOWN_HOOK, "", "", "register 
shutdown hook failed: " + e.getMessage(), e);
             } catch (Exception e) {
-                logger.warn("5-2", "", "", "register shutdown hook failed: " + 
e.getMessage(), e);
+                logger.warn(CONFIG_FAILED_SHUTDOWN_HOOK, "", "", "register 
shutdown hook failed: " + e.getMessage(), e);
             }
         }
     }
@@ -105,9 +107,9 @@ public class DubboShutdownHook extends Thread {
             try {
                 Runtime.getRuntime().removeShutdownHook(this);
             } catch (IllegalStateException e) {
-                logger.warn("5-2", "", "", "unregister shutdown hook failed: " 
+ e.getMessage(), e);
+                logger.warn(CONFIG_FAILED_SHUTDOWN_HOOK, "", "", "unregister 
shutdown hook failed: " + e.getMessage(), e);
             } catch (Exception e) {
-                logger.warn("5-2", "", "", "unregister shutdown hook failed: " 
+ e.getMessage(), e);
+                logger.warn(CONFIG_FAILED_SHUTDOWN_HOOK, "", "", "unregister 
shutdown hook failed: " + e.getMessage(), e);
             }
         }
     }
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
index cdeb2e7873..f63f5f7df3 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
@@ -81,6 +81,11 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.SVC;
 import static org.apache.dubbo.common.constants.CommonConstants.TRIPLE;
 import static 
org.apache.dubbo.common.constants.CommonConstants.UNLOAD_CLUSTER_RELATED;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_NO_VALID_PROVIDER;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_DESTROY_INVOKER;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NO_METHOD_FOUND;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_LOAD_ENV_VARIABLE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_PROPERTY_CONFLICT;
 import static org.apache.dubbo.common.constants.RegistryConstants.PROVIDED_BY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.SUBSCRIBED_SERVICE_NAMES_KEY;
 import static org.apache.dubbo.common.utils.NetUtils.isInvalidLocalHost;
@@ -244,7 +249,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
                 invoker.destroy();
             }
         } catch (Throwable t) {
-            logger.warn("5-3", "", "", "Unexpected error occurred when destroy 
invoker of ReferenceConfig(" + url + ").", t);
+            logger.warn(CONFIG_FAILED_DESTROY_INVOKER, "", "", "Unexpected 
error occurred when destroy invoker of ReferenceConfig(" + url + ").", t);
         }
         invoker = null;
         ref = null;
@@ -308,7 +313,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
                     invoker.destroy();
                 }
             } catch (Throwable destroy) {
-                logger.warn("5-3", "", "", "Unexpected error occurred when 
destroy invoker of ReferenceConfig(" + url + ").", t);
+                logger.warn(CONFIG_FAILED_DESTROY_INVOKER, "", "", "Unexpected 
error occurred when destroy invoker of ReferenceConfig(" + url + ").", t);
             }
             if (consumerModel != null) {
                 ModuleServiceRepository repository = 
getScopeModel().getServiceRepository();
@@ -326,7 +331,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
                 t.getMessage().contains("No provider available for the 
service")) {
 
                 // 2-2 - No provider available.
-                logger.error("2-2", "server crashed", "", "No provider 
available.", t);
+                logger.error(CLUSTER_NO_VALID_PROVIDER, "server crashed", "", 
"No provider available.", t);
             }
 
             throw t;
@@ -381,7 +386,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
 
             String[] methods = methods(interfaceClass);
             if (methods.length == 0) {
-                logger.warn("5-4", "", "", "No method found in service 
interface: " + interfaceClass.getName());
+                logger.warn(CONFIG_NO_METHOD_FOUND, "", "", "No method found 
in service interface: " + interfaceClass.getName());
                 map.put(METHODS_KEY, ANY_VALUE);
             } else {
                 map.put(METHODS_KEY, StringUtils.join(new 
HashSet<>(Arrays.asList(methods)), COMMA_SEPARATOR));
@@ -477,7 +482,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
         String podNamespace;
         if (StringUtils.isEmpty(System.getenv("POD_NAMESPACE"))) {
             if (logger.isWarnEnabled()) {
-                logger.warn("5-5", "", "", "Can not get env variable: 
POD_NAMESPACE, it may not be running in the K8S environment , " +
+                logger.warn(CONFIG_FAILED_LOAD_ENV_VARIABLE, "", "", "Can not 
get env variable: POD_NAMESPACE, it may not be running in the K8S environment , 
" +
                     "finally use 'default' replace.");
             }
             podNamespace = "default";
@@ -655,7 +660,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
                     + " to the consumer "
                     + NetUtils.getLocalHost() + " use dubbo version " + 
Version.getVersion());
 
-            logger.error("2-2", "provider not started", "", "No provider 
available.", illegalStateException);
+            logger.error(CLUSTER_NO_VALID_PROVIDER, "provider not started", 
"", "No provider available.", illegalStateException);
 
             throw illegalStateException;
         }
@@ -683,7 +688,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
         }
         if (ProtocolUtils.isGeneric(generic)) {
             if (interfaceClass != null && 
!interfaceClass.equals(GenericService.class)) {
-                logger.warn("5-6", "", "", String.format("Found conflicting 
attributes for interface type: [interfaceClass=%s] and [generic=%s], " +
+                logger.warn(CONFIG_PROPERTY_CONFLICT, "", "", 
String.format("Found conflicting attributes for interface type: 
[interfaceClass=%s] and [generic=%s], " +
                         "because the 'generic' attribute has higher priority 
than 'interfaceClass', so change 'interfaceClass' to '%s'. " +
                         "Note: it will make this reference bean as a candidate 
bean of type '%s' instead of '%s' when resolving dependency in Spring.",
                     interfaceClass.getName(), generic, 
GenericService.class.getName(), GenericService.class.getName(), 
interfaceClass.getName()));
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
index 833184fbd1..7e8c3f9727 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
@@ -71,6 +71,11 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
 import static org.apache.dubbo.common.constants.CommonConstants.REVISION_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.SERVICE_NAME_MAPPING_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_NO_METHOD_FOUND;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_UNEXPORT_ERROR;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_USE_RANDOM_PORT;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_EXPORT_SERVICE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_SERVER_DISCONNECTED;
 import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.SERVICE_REGISTRY_PROTOCOL;
 import static org.apache.dubbo.common.utils.NetUtils.getAvailablePort;
@@ -182,7 +187,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
                 try {
                     exporter.unexport();
                 } catch (Throwable t) {
-                    logger.warn("5-7", "", "", "Unexpected error occurred when 
unexport " + exporter, t);
+                    logger.warn(CONFIG_UNEXPORT_ERROR, "", "", "Unexpected 
error occurred when unexport " + exporter, t);
                 }
             }
             exporters.clear();
@@ -243,7 +248,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
                 try {
                     doExport();
                 } catch (Exception e) {
-                    logger.error("5-9", "configuration server disconnected", 
"", "Failed to (async)export service config: " + interfaceName, e);
+                    logger.error(CONFIG_FAILED_EXPORT_SERVICE, "configuration 
server disconnected", "", "Failed to (async)export service config: " + 
interfaceName, e);
                 }
             }, getDelay(), TimeUnit.MILLISECONDS);
     }
@@ -259,10 +264,10 @@ public class ServiceConfig<T> extends 
ServiceConfigBase<T> {
                     if (succeeded) {
                         logger.info("Successfully registered interface 
application mapping for service " + url.getServiceKey());
                     } else {
-                        logger.error("5-10", "configuration server 
disconnected", "", "Failed register interface application mapping for service " 
+ url.getServiceKey());
+                        logger.error(CONFIG_SERVER_DISCONNECTED, 
"configuration server disconnected", "", "Failed register interface application 
mapping for service " + url.getServiceKey());
                     }
                 } catch (Exception e) {
-                    logger.error("5-10", "configuration server disconnected", 
"", "Failed register interface application mapping for service " + 
url.getServiceKey(), e);
+                    logger.error(CONFIG_SERVER_DISCONNECTED, "configuration 
server disconnected", "", "Failed register interface application mapping for 
service " + url.getServiceKey(), e);
                 }
             }
         });
@@ -448,7 +453,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
 
             String[] methods = methods(interfaceClass);
             if (methods.length == 0) {
-                logger.warn("5-4", "", "", "No method found in service 
interface: " + interfaceClass.getName());
+                logger.warn(CONFIG_NO_METHOD_FOUND, "", "", "No method found 
in service interface: " + interfaceClass.getName());
                 map.put(METHODS_KEY, ANY_VALUE);
             } else {
                 map.put(METHODS_KEY, StringUtils.join(new 
HashSet<>(Arrays.asList(methods)), ","));
@@ -841,7 +846,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
         protocol = protocol.toLowerCase();
         if (!RANDOM_PORT_MAP.containsKey(protocol)) {
             RANDOM_PORT_MAP.put(protocol, port);
-            logger.warn("5-8", "", "", "Use random available port(" + port + 
") for protocol " + protocol);
+            logger.warn(CONFIG_USE_RANDOM_PORT, "", "", "Use random available 
port(" + port + ") for protocol " + protocol);
         }
     }
 
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
index c5e19c4bd0..441598e375 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
@@ -73,6 +73,8 @@ import static java.lang.String.format;
 import static 
org.apache.dubbo.common.config.ConfigurationUtils.parseProperties;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REGISTRY_SPLIT_PATTERN;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_REFRESH_INSTANCE_ERROR;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_REGISTER_INSTANCE_ERROR;
 import static org.apache.dubbo.common.utils.StringUtils.isEmpty;
 import static org.apache.dubbo.common.utils.StringUtils.isNotEmpty;
 import static 
org.apache.dubbo.metadata.MetadataConstants.DEFAULT_METADATA_PUBLISH_DELAY;
@@ -722,7 +724,7 @@ public class DefaultApplicationDeployer extends 
AbstractDeployer<ApplicationMode
             registered = true;
             
ServiceInstanceMetadataUtils.registerMetadataAndInstance(applicationModel);
         } catch (Exception e) {
-            logger.error("5-11", "configuration server disconnected", "", 
"Register instance error.", e);
+            logger.error(CONFIG_REGISTER_INSTANCE_ERROR, "configuration server 
disconnected", "", "Register instance error.", e);
         }
         if (registered) {
             // scheduled task for updating Metadata and ServiceInstance
@@ -738,7 +740,7 @@ public class DefaultApplicationDeployer extends 
AbstractDeployer<ApplicationMode
                     }
                 } catch (Exception e) {
                     if (!applicationModel.isDestroyed()) {
-                        logger.error("5-12", "", "", "Refresh instance and 
metadata error.", e);
+                        logger.error(CONFIG_REFRESH_INSTANCE_ERROR, "", "", 
"Refresh instance and metadata error.", e);
                     }
                 }
             }, 0, ConfigurationUtils.get(applicationModel, 
METADATA_PUBLISH_DELAY_KEY, DEFAULT_METADATA_PUBLISH_DELAY), 
TimeUnit.MILLISECONDS);
@@ -956,7 +958,7 @@ public class DefaultApplicationDeployer extends 
AbstractDeployer<ApplicationMode
                     
ServiceInstanceMetadataUtils.refreshMetadataAndInstance(applicationModel);
                 }
             } catch (Exception e) {
-                logger.error("5-12", "", "", "Refresh instance and metadata 
error.", e);
+                logger.error(CONFIG_REFRESH_INSTANCE_ERROR, "", "", "Refresh 
instance and metadata error.", e);
             }
         } finally {
             // complete future
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultModuleDeployer.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultModuleDeployer.java
index 01c8906134..f692dcd11b 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultModuleDeployer.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultModuleDeployer.java
@@ -46,6 +46,11 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_START_MODEL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_UNABLE_DESTROY_MODEL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_REFERENCE_MODEL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_EXPORT_SERVICE;
+
 /**
  * Export/refer services of module
  */
@@ -223,7 +228,7 @@ public class DefaultModuleDeployer extends 
AbstractDeployer<ModuleModel> impleme
                         consumerModel.getDestroyRunner().run();
                     }
                 } catch (Throwable t) {
-                    logger.error("5-13", "there are problems with the custom 
implementation.", "", "Unable to destroy model: consumerModel.", t);
+                    logger.error(CONFIG_UNABLE_DESTROY_MODEL, "there are 
problems with the custom implementation.", "", "Unable to destroy model: 
consumerModel.", t);
                 }
             }
 
@@ -234,7 +239,7 @@ public class DefaultModuleDeployer extends 
AbstractDeployer<ModuleModel> impleme
                         providerModel.getDestroyRunner().run();
                     }
                 } catch (Throwable t) {
-                    logger.error("5-13", "there are problems with the custom 
implementation.", "", "Unable to destroy model: providerModel.", t);
+                    logger.error(CONFIG_UNABLE_DESTROY_MODEL, "there are 
problems with the custom implementation.", "", "Unable to destroy model: 
providerModel.", t);
                 }
             }
             serviceRepository.destroy();
@@ -265,7 +270,7 @@ public class DefaultModuleDeployer extends 
AbstractDeployer<ModuleModel> impleme
     private void onModuleFailed(String msg, Throwable ex) {
         try {
             setFailed(ex);
-            logger.error("5-14", "", "", "Model start failed: " + msg, ex);
+            logger.error(CONFIG_FAILED_START_MODEL, "", "", "Model start 
failed: " + msg, ex);
             applicationDeployer.notifyModuleChanged(moduleModel, 
DeployState.STARTED);
         } finally {
             completeStartFuture(false);
@@ -333,7 +338,7 @@ public class DefaultModuleDeployer extends 
AbstractDeployer<ModuleModel> impleme
                         exportedServices.add(sc);
                     }
                 } catch (Throwable t) {
-                    logger.error("5-9", "", "", "Failed to async export 
service config: " + getIdentifier() + " , catch error : " + t.getMessage(), t);
+                    logger.error(CONFIG_FAILED_EXPORT_SERVICE, "", "", "Failed 
to async export service config: " + getIdentifier() + " , catch error : " + 
t.getMessage(), t);
                 }
             }, executor);
 
@@ -380,7 +385,7 @@ public class DefaultModuleDeployer extends 
AbstractDeployer<ModuleModel> impleme
                             try {
                                 referenceCache.get(rc);
                             } catch (Throwable t) {
-                                logger.error("5-9", "", "", "Failed to async 
export service config: " + getIdentifier() + " , catch error : " + 
t.getMessage(), t);
+                                logger.error(CONFIG_FAILED_EXPORT_SERVICE, "", 
"", "Failed to async export service config: " + getIdentifier() + " , catch 
error : " + t.getMessage(), t);
                             }
                         }, executor);
 
@@ -390,7 +395,7 @@ public class DefaultModuleDeployer extends 
AbstractDeployer<ModuleModel> impleme
                     }
                 }
             } catch (Throwable t) {
-                logger.error("5-15", "", "", "Model reference failed: " + 
getIdentifier() + " , catch error : " + t.getMessage(), t);
+                logger.error(CONFIG_FAILED_REFERENCE_MODEL, "", "", "Model 
reference failed: " + getIdentifier() + " , catch error : " + t.getMessage(), 
t);
                 referenceCache.destroy(rc);
                 throw t;
             }
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java
index e99025c9e5..d663e8add1 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ConfigurableMetadataServiceExporter.java
@@ -46,6 +46,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.METADATA_SERVICE
 import static 
org.apache.dubbo.common.constants.CommonConstants.METADATA_SERVICE_PROTOCOL_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_FIND_PROTOCOL;
 import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY;
 
 /**
@@ -139,7 +140,7 @@ public class ConfigurableMetadataServiceExporter {
                     }
                 }
             } catch (Exception e) {
-                logger.error("5-16", "invalid specified " + specifiedProtocol 
+ "  protocol", "", "Failed to find any valid protocol, will use random port to 
export metadata service.", e);
+                logger.error(CONFIG_FAILED_FIND_PROTOCOL, "invalid specified " 
+ specifiedProtocol + "  protocol", "", "Failed to find any valid protocol, 
will use random port to export metadata service.", e);
             }
         } else {
             protocolConfig.setPort(port);
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java
index de04dd6fb8..17c73636d3 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/utils/ConfigValidationUtils.java
@@ -99,6 +99,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_SE
 import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.USERNAME_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_PARAMETER_FORMAT_ERROR;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_REGISTER_MODE_ALL;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_REGISTER_MODE_INSTANCE;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_REGISTER_MODE_INTERFACE;
@@ -726,13 +727,13 @@ public class ConfigValidationUtils {
             return;
         }
         if (value.length() > maxlength) {
-            logger.error("5-17", "the value content is too long", "", 
"Parameter value format error. Invalid " +
+            logger.error(CONFIG_PARAMETER_FORMAT_ERROR, "the value content is 
too long", "", "Parameter value format error. Invalid " +
                 property + "=\"" + value + "\" is longer than " + maxlength);
         }
         if (pattern != null) {
             Matcher matcher = pattern.matcher(value);
             if (!matcher.matches()) {
-                logger.error("5-17", "the value content is illegal character", 
"", "Parameter value format error. Invalid " +
+                logger.error(CONFIG_PARAMETER_FORMAT_ERROR, "the value content 
is illegal character", "", "Parameter value format error. Invalid " +
                     property + "=\"" + value + "\" contains illegal " +
                     "character, only digit, letter, '-', '_' or '.' is 
legal.");
             }
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java
 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java
index 72c43dc8fa..7aa7dd2822 100644
--- 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java
+++ 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/context/DubboDeployApplicationListener.java
@@ -16,6 +16,7 @@
  */
 package org.apache.dubbo.config.spring.context;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_STOP_DUBBO_ERROR;
 import static org.springframework.util.ObjectUtils.nullSafeEquals;
 
 import java.util.concurrent.Future;
@@ -130,7 +131,7 @@ public class DubboDeployApplicationListener implements 
ApplicationListener<Appli
                 moduleModel.destroy();
             }
         } catch (Exception e) {
-            logger.error("5-20", "", "", "Unexpected error occurred when stop 
dubbo module: " + e.getMessage(), e);
+            logger.error(CONFIG_STOP_DUBBO_ERROR, "", "", "Unexpected error 
occurred when stop dubbo module: " + e.getMessage(), e);
         }
         // remove context bind cache
         DubboSpringInitializer.remove(event.getApplicationContext());
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/AbstractRegistryService.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/AbstractRegistryService.java
index 731789811e..9ac517c37b 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/AbstractRegistryService.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/AbstractRegistryService.java
@@ -32,6 +32,8 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_NOTIFY_EVENT;
+
 /**
  * AbstractRegistryService
  */
@@ -184,7 +186,7 @@ public abstract class AbstractRegistryService implements 
RegistryService {
                 try {
                     notify(service, urls, listener);
                 } catch (Throwable t) {
-                    logger.error("5-18", "", "", "Failed to notify registry 
event, service: " + service + ", urls: " + urls + ", cause: " + t.getMessage(), 
t);
+                    logger.error(CONFIG_FAILED_NOTIFY_EVENT, "", "", "Failed 
to notify registry event, service: " + service + ", urls: " + urls + ", cause: 
" + t.getMessage(), t);
                 }
             }
         }
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/EmbeddedZooKeeper.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/EmbeddedZooKeeper.java
index 6c6ea7c85b..009f371bb9 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/EmbeddedZooKeeper.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/EmbeddedZooKeeper.java
@@ -29,6 +29,8 @@ import java.lang.reflect.Method;
 import java.util.Properties;
 import java.util.UUID;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_ZOOKEEPER_SERVER_ERROR;
+
 /**
  * from: 
https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
  * <p>
@@ -238,7 +240,7 @@ public class EmbeddedZooKeeper implements SmartLifecycle {
                 if (errorHandler != null) {
                     errorHandler.handleError(e);
                 } else {
-                    logger.error("5-19", "ZooKeeper server error", "", 
"Exception running embedded ZooKeeper.", e);
+                    logger.error(CONFIG_ZOOKEEPER_SERVER_ERROR, "ZooKeeper 
server error", "", "Exception running embedded ZooKeeper.", e);
                 }
             }
         }
diff --git 
a/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
 
b/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
index 414182368e..b9c6d5714e 100644
--- 
a/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
+++ 
b/dubbo-configcenter/dubbo-configcenter-apollo/src/main/java/org/apache/dubbo/configcenter/support/apollo/ApolloDynamicConfiguration.java
@@ -47,6 +47,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.CHECK_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
 import static 
org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CONNECT_REGISTRY;
 
 /**
  * Apollo implementation, https://github.com/ctripcorp/apollo
@@ -108,7 +109,7 @@ public class ApolloDynamicConfiguration implements 
DynamicConfiguration {
             } else {
                 // 5-1 Failed to connect to configuration center.
 
-                logger.warn("5-1", "configuration server offline", "",
+                logger.warn(CONFIG_FAILED_CONNECT_REGISTRY, "configuration 
server offline", "",
                     "Failed to connect to config center, the config center is 
Apollo, " +
                     "the address is: " + (StringUtils.isNotEmpty(configAddr) ? 
configAddr : configEnv) +
                     ", will use the local cache value instead before 
eventually the connection is established.");
diff --git 
a/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
 
b/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
index e30c3bef7f..cd20375fa3 100644
--- 
a/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
+++ 
b/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java
@@ -35,6 +35,8 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CONNECT_REGISTRY;
+
 public class ZookeeperDynamicConfiguration extends 
TreePathDynamicConfiguration {
 
     private Executor executor;
@@ -65,7 +67,7 @@ public class ZookeeperDynamicConfiguration extends 
TreePathDynamicConfiguration
                 new IllegalStateException("Failed to connect with zookeeper, 
pls check if url " + url + " is correct.");
 
             if (logger != null) {
-                logger.error("5-1", "configuration server offline", "",
+                logger.error(CONFIG_FAILED_CONNECT_REGISTRY, "configuration 
server offline", "",
                     "Failed to connect with zookeeper", illegalStateException);
             }
 
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ReflectionBasedServiceDiscovery.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ReflectionBasedServiceDiscovery.java
index 8112a6ba71..02c8c15d8a 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ReflectionBasedServiceDiscovery.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ReflectionBasedServiceDiscovery.java
@@ -52,6 +52,8 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_NOTIFY_EVENT;
+
 public class ReflectionBasedServiceDiscovery extends AbstractServiceDiscovery {
 
     private final ErrorTypeAwareLogger logger = 
LoggerFactory.getErrorTypeAwareLogger(getClass());
@@ -163,7 +165,7 @@ public class ReflectionBasedServiceDiscovery extends 
AbstractServiceDiscovery {
                     // 1-7 - Failed to notify registry event.
                     // The updating of metadata to consumer is a type of 
registry event.
 
-                    logger.warn("1-7", "consumer is offline", "",
+                    logger.warn(REGISTRY_FAILED_NOTIFY_EVENT, "consumer is 
offline", "",
                         "Notify to consumer error, removing listener.");
 
                     // remove listener if consumer is offline
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
index bdcf62de93..a3e68cdbb6 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
@@ -61,6 +61,7 @@ import java.util.stream.Collectors;
 import static org.apache.dubbo.common.constants.CommonConstants.DISABLED_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.ENABLED_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_UNSUPPORTED;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_HASHMAP_LOAD_FACTOR;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
@@ -297,7 +298,7 @@ public class ServiceDiscoveryRegistryDirectory<T> extends 
DynamicDirectory<T> {
 
                 // 4-1 - Unsupported protocol
 
-                logger.error("4-1", "protocol extension does not installed", 
"", "Unsupported protocol.",
+                logger.error(PROTOCOL_UNSUPPORTED, "protocol extension does 
not installed", "", "Unsupported protocol.",
                     new IllegalStateException("Unsupported protocol " + 
instanceAddressURL.getProtocol() +
                     " in notified url: " + instanceAddressURL + " from 
registry " + getUrl().getAddress() +
                     " to consumer " + NetUtils.getLocalHost() + ", supported 
protocol: " +
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java
index cc311fac90..8cb30728a3 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java
@@ -55,6 +55,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_REFRESH_ADDRESS;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.ENABLE_EMPTY_PROTECTION_KEY;
 import static org.apache.dubbo.metadata.RevisionResolver.EMPTY_REVISION;
@@ -185,7 +186,7 @@ public class ServiceInstancesChangedListener {
             // return if all metadata is empty, this notification will not 
take effect.
             if (emptyNum == revisionToInstances.size()) {
                 // 1-17 - Address refresh failed.
-                logger.error("1-17", "metadata Server failure", "",
+                logger.error(REGISTRY_FAILED_REFRESH_ADDRESS, "metadata Server 
failure", "",
                     "Address refresh failed because of Metadata Server 
failure, wait for retry or new address refresh event.");
 
                 return;
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceHostPortCustomizer.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceHostPortCustomizer.java
index 9e5a20742a..f5786c2316 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceHostPortCustomizer.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceHostPortCustomizer.java
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER;
+
 /**
  * The {@link ServiceInstanceCustomizer} to customize the {@link 
ServiceInstance#getPort() port} of service instance.
  */
@@ -74,7 +76,7 @@ public class ServiceInstanceHostPortCustomizer implements 
ServiceInstanceCustomi
 
                     // 4-2 - Can't find an instance URL using the default 
preferredProtocol.
 
-                    logger.warn("4-2", "typo in preferred protocol", "",
+                    logger.warn(PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER, 
"typo in preferred protocol", "",
                         "Can't find an instance URL using the default 
preferredProtocol \"" + preferredProtocol + "\", " +
                         "falling back to the strategy that pick the first 
found protocol. " +
                         "Please try modifying the config of 
dubbo.application.protocol");
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilder.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilder.java
index 509a85c2f3..b36139a861 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilder.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/StandardMetadataServiceURLBuilder.java
@@ -44,6 +44,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_MISSING_METADATA_CONFIG_PORT;
 import static org.apache.dubbo.common.utils.StringUtils.isBlank;
 import static 
org.apache.dubbo.metadata.MetadataConstants.DEFAULT_METADATA_TIMEOUT_VALUE;
 import static 
org.apache.dubbo.metadata.MetadataConstants.METADATA_PROXY_TIMEOUT_KEY;
@@ -127,7 +128,7 @@ public class StandardMetadataServiceURLBuilder implements 
MetadataServiceURLBuil
 
             // 1-18 - Metadata Service Port should be specified for consumer.
 
-            logger.warn("1-18", "missing configuration of metadata service 
port", "",
+            logger.warn(REGISTRY_MISSING_METADATA_CONFIG_PORT, "missing 
configuration of metadata service port", "",
                 "Metadata Service Port is not provided. Since DNS is not able 
to negotiate the metadata port " +
                     "between Provider and Consumer, Dubbo will try using 
instance port as the default metadata port.");
 
@@ -145,7 +146,7 @@ public class StandardMetadataServiceURLBuilder implements 
MetadataServiceURLBuil
 
             IllegalStateException illegalStateException = new 
IllegalStateException(message);
 
-            logger.error("1-18", "missing configuration of metadata service 
port", "",
+            logger.error(REGISTRY_MISSING_METADATA_CONFIG_PORT, "missing 
configuration of metadata service port", "",
                 message, illegalStateException);
 
             throw illegalStateException;
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
index bd57dc5fdf..75dbd7d12f 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/AbstractConfiguratorListener.java
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_PARSE_DYNAMIC_CONFIG;
 import static org.apache.dubbo.rpc.Constants.ACCESS_LOG_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.ROUTER_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY;
@@ -109,7 +110,7 @@ public abstract class AbstractConfiguratorListener 
implements ConfigurationListe
         } catch (Exception e) {
             // 1-14 - Failed to parse raw dynamic config.
 
-            logger.warn("1-14", "", "",
+            logger.warn(REGISTRY_FAILED_PARSE_DYNAMIC_CONFIG, "", "",
                 "Failed to parse raw dynamic config and it will not take 
effect, the raw config is: "
                     + rawConfig + ", cause: " + e.getMessage());
 
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
index 922bfbaa5c..167cdd2105 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/DynamicDirectory.java
@@ -46,6 +46,9 @@ import org.apache.dubbo.rpc.model.ModuleModel;
 import java.util.List;
 
 import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DESTROY_SERVICE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DESTROY_UNREGISTER_URL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CLUSTER_FAILED_SITE_SELECTION;
 import static org.apache.dubbo.common.constants.RegistryConstants.CATEGORY_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.CONSUMERS_CATEGORY;
 import static org.apache.dubbo.registry.Constants.REGISTER_KEY;
@@ -205,7 +208,7 @@ public abstract class DynamicDirectory<T> extends 
AbstractDirectory<T> implement
             return result == null ? BitList.emptyList() : result;
         } catch (Throwable t) {
             // 2-1 - Failed to execute routing.
-            logger.error("2-1", "", "",
+            logger.error(CLUSTER_FAILED_SITE_SELECTION, "", "",
                 "Failed to execute router: " + getUrl() + ", cause: " + 
t.getMessage(), t);
 
             return BitList.emptyList();
@@ -299,7 +302,7 @@ public abstract class DynamicDirectory<T> extends 
AbstractDirectory<T> implement
             }
         } catch (Throwable t) {
             // 1-8: Failed to unregister / unsubscribe url on destroy.
-            logger.warn("1-8", "", "",
+            logger.warn(REGISTRY_FAILED_DESTROY_UNREGISTER_URL, "", "",
                 "unexpected error when unregister service " + serviceKey + " 
from registry: " + registry.getUrl(), t);
         }
 
@@ -310,7 +313,7 @@ public abstract class DynamicDirectory<T> extends 
AbstractDirectory<T> implement
             }
         } catch (Throwable t) {
             // 1-8: Failed to unregister / unsubscribe url on destroy.
-            logger.warn("1-8", "", "",
+            logger.warn(REGISTRY_FAILED_DESTROY_UNREGISTER_URL, "", "",
                 "unexpected error when unsubscribe service " + serviceKey + " 
from registry: " + registry.getUrl(), t);
         }
 
@@ -327,7 +330,7 @@ public abstract class DynamicDirectory<T> extends 
AbstractDirectory<T> implement
                 destroyAllInvokers();
             } catch (Throwable t) {
                 // 1-15 - Failed to destroy service.
-                logger.warn("1-15", "", "",
+                logger.warn(REGISTRY_FAILED_DESTROY_SERVICE, "", "",
                     "Failed to destroy service " + serviceKey, t);
             }
             routerChain.destroy();
@@ -344,7 +347,7 @@ public abstract class DynamicDirectory<T> extends 
AbstractDirectory<T> implement
             destroyAllInvokers();
         } catch (Throwable t) {
             // 1-15 - Failed to destroy service.
-            logger.warn("1-15", "", "",
+            logger.warn(REGISTRY_FAILED_DESTROY_SERVICE, "", "",
                 "Failed to destroy service " + serviceKey, t);
         }
     }
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
index afe194898c..25389e35e4 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
@@ -62,6 +62,13 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.ENABLED_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.TAG_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_EMPTY_ADDRESS;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DESTROY_SERVICE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_UNSUPPORTED_CATEGORY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.PROXY_FAILED_CONVERT_URL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_UNSUPPORTED;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_FAILED_REFER_INVOKER;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.APP_DYNAMIC_CONFIGURATORS_CATEGORY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.COMPATIBLE_CONFIG_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.CONFIGURATORS_CATEGORY;
@@ -227,7 +234,7 @@ public class RegistryDirectory<T> extends 
DynamicDirectory<T> {
             if (invokerUrls.isEmpty() && localCachedInvokerUrls != null) {
 
                 // 1-4 Empty address.
-                logger.warn("1-4", "configuration ", "",
+                logger.warn(REGISTRY_EMPTY_ADDRESS, "configuration ", "",
                     "Service" + serviceKey + " received empty address list 
with no EMPTY protocol set, trigger empty protection.");
 
                 invokerUrls.addAll(localCachedInvokerUrls);
@@ -265,7 +272,7 @@ public class RegistryDirectory<T> extends 
DynamicDirectory<T> {
                 // 3-1 - Failed to convert the URL address into Invokers.
 
                 logger.error(
-                    "3-1", "inconsistency between the client protocol and the 
protocol of the server",
+                    PROXY_FAILED_CONVERT_URL, "inconsistency between the 
client protocol and the protocol of the server",
                     "", "urls to invokers error",
                     new IllegalStateException(
                         "urls to invokers error. invokerUrls.size :" +
@@ -387,12 +394,12 @@ public class RegistryDirectory<T> extends 
DynamicDirectory<T> {
                     // Thrown by AbstractProtocol.optimizeSerialization()
                     if (t instanceof RpcException && 
t.getMessage().contains("serialization optimizer")) {
                         // 4-2 - serialization optimizer class initialization 
failed.
-                        logger.error("4-2", "typo in optimizer class", "",
+                        
logger.error(PROTOCOL_FAILED_INIT_SERIALIZATION_OPTIMIZER, "typo in optimizer 
class", "",
                             "Failed to refer invoker for interface:" + 
serviceType + ",url:(" + url + ")" + t.getMessage(), t);
 
                     } else {
                         // 4-3 - Failed to refer invoker by other reason.
-                        logger.error("4-3", "", "",
+                        logger.error(PROTOCOL_FAILED_REFER_INVOKER, "", "",
                             "Failed to refer invoker for interface:" + 
serviceType + ",url:(" + url + ")" + t.getMessage(), t);
                     }
                 }
@@ -432,7 +439,7 @@ public class RegistryDirectory<T> extends 
DynamicDirectory<T> {
 
             // 4-1 - Unsupported protocol
 
-            logger.error("4-1", "protocol extension does not installed", "", 
"Unsupported protocol.",
+            logger.error(PROTOCOL_UNSUPPORTED, "protocol extension does not 
installed", "", "Unsupported protocol.",
                 new IllegalStateException("Unsupported protocol " + 
providerUrl.getProtocol() +
                 " in notified url: " + providerUrl + " from registry " + 
getUrl().getAddress() +
                 " to consumer " + NetUtils.getLocalHost() + ", supported 
protocol: " +
@@ -540,7 +547,7 @@ public class RegistryDirectory<T> extends 
DynamicDirectory<T> {
                     invoker.destroyAll();
                 } catch (Throwable t) {
                     // 1-15 - Failed to destroy service
-                    logger.warn("1-15", "", "",
+                    logger.warn(REGISTRY_FAILED_DESTROY_SERVICE, "", "",
                         "Failed to destroy service " + serviceKey + " to 
provider " + invoker.getUrl(), t);
                 }
             }
@@ -596,7 +603,7 @@ public class RegistryDirectory<T> extends 
DynamicDirectory<T> {
         }
 
         // 1-16 - Unsupported category in NotifyListener
-        logger.warn("1-16", "", "",
+        logger.warn(REGISTRY_UNSUPPORTED_CATEGORY, "", "",
             "Unsupported category " + category + " in notified url: " + url + 
" from registry " +
             getUrl().getAddress() + " to consumer " + NetUtils.getLocalHost());
 
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java
index bcfe7d4ed8..425430b134 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/retry/AbstractRetryTask.java
@@ -28,6 +28,7 @@ import org.apache.dubbo.registry.support.FailbackRegistry;
 
 import java.util.concurrent.TimeUnit;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_EXECUTE_RETRYING_TASK;
 import static 
org.apache.dubbo.registry.Constants.DEFAULT_REGISTRY_RETRY_PERIOD;
 import static org.apache.dubbo.registry.Constants.DEFAULT_REGISTRY_RETRY_TIMES;
 import static org.apache.dubbo.registry.Constants.REGISTRY_RETRY_PERIOD_KEY;
@@ -116,7 +117,7 @@ public abstract class AbstractRetryTask implements 
TimerTask {
             // 1-13 - failed to execute the retrying task.
 
             logger.warn(
-                "1-13", "registry center offline", "Check the registry 
server.",
+                REGISTRY_EXECUTE_RETRYING_TASK, "registry center offline", 
"Check the registry server.",
                 "Final failed to execute task " + taskName + ", url: " + url + 
", retry " + retryTimes + " times.");
 
             return;
@@ -130,7 +131,7 @@ public abstract class AbstractRetryTask implements 
TimerTask {
 
             // 1-13 - failed to execute the retrying task.
 
-            logger.warn("1-13", "registry center offline", "Check the registry 
server.",
+            logger.warn(REGISTRY_EXECUTE_RETRYING_TASK, "registry center 
offline", "Check the registry server.",
                 "Failed to execute task " + taskName + ", url: " + url + ", 
waiting for again, cause:" + t.getMessage(), t);
 
             // reput this task when catch exception.
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java
index da86143533..01a3e3e356 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java
@@ -61,6 +61,11 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE;
 import static 
org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
 import static org.apache.dubbo.common.constants.CommonConstants.FILE_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REGISTRY_LOCAL_FILE_CACHE_ENABLED;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_EMPTY_ADDRESS;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_NOTIFY_EVENT;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DESTROY_UNREGISTER_URL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_READ_WRITE_CACHE_FILE;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_DELETE_LOCKFILE;
 import static org.apache.dubbo.common.constants.RegistryConstants.ACCEPTS_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_CATEGORY;
 import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_KEY;
@@ -137,7 +142,7 @@ public abstract class AbstractRegistry implements Registry {
                         if (logger != null) {
                             // 1-9 failed to read / save registry cache file.
 
-                            logger.error("1-9", "cache directory inaccessible",
+                            
logger.error(REGISTRY_FAILED_READ_WRITE_CACHE_FILE, "cache directory 
inaccessible",
                                 "Try adjusting permission of the directory.",
                                 "failed to create directory", 
illegalArgumentException);
                         }
@@ -225,7 +230,7 @@ public abstract class AbstractRegistry implements Registry {
                         "ignore and retry later, maybe multi java process use 
the file, please config: dubbo.registry.file=xxx.properties");
 
                     // 1-9 failed to read / save registry cache file.
-                    logger.warn("1-9", CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
+                    logger.warn(REGISTRY_FAILED_READ_WRITE_CACHE_FILE, 
CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
                         "Adjust dubbo.registry.file.", ioException);
 
                     throw ioException;
@@ -268,7 +273,7 @@ public abstract class AbstractRegistry implements Registry {
                     logger.info("Failed to save registry cache file for file 
overlapping lock exception, file name " + file.getName());
                 } else {
                     // 1-9 failed to read / save registry cache file.
-                    logger.warn("1-9", CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
+                    logger.warn(REGISTRY_FAILED_READ_WRITE_CACHE_FILE, 
CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
                         "Failed to save registry cache file after retrying " + 
MAX_RETRY_TIMES_SAVE_PROPERTIES + " times, cause: " + e.getMessage(), e);
                 }
 
@@ -284,7 +289,7 @@ public abstract class AbstractRegistry implements Registry {
             }
 
             if (!(e instanceof OverlappingFileLockException)) {
-                logger.warn("1-9", CAUSE_MULTI_DUBBO_USING_SAME_FILE,
+                logger.warn(REGISTRY_FAILED_READ_WRITE_CACHE_FILE, 
CAUSE_MULTI_DUBBO_USING_SAME_FILE,
                     "However, the retrying count limit is not exceeded. Dubbo 
will still try.",
                     "Failed to save registry cache file, will retry, cause: " 
+ e.getMessage(), e);
             }
@@ -292,7 +297,7 @@ public abstract class AbstractRegistry implements Registry {
             if (lockfile != null) {
                 if (!lockfile.delete()) {
                     // 1-10 Failed to delete lock file.
-                    logger.warn("1-10", "", "",
+                    logger.warn(REGISTRY_FAILED_DELETE_LOCKFILE, "", "",
                         String.format("Failed to delete lock file [%s]", 
lockfile.getName()));
                 }
             }
@@ -310,13 +315,12 @@ public abstract class AbstractRegistry implements 
Registry {
             }
         } catch (IOException e) {
             // 1-9 failed to read / save registry cache file.
-            logger.warn("1-9", CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
+            logger.warn(REGISTRY_FAILED_READ_WRITE_CACHE_FILE, 
CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
                 e.getMessage(), e);
 
         } catch (Throwable e) {
             // 1-9 failed to read / save registry cache file.
-
-            logger.warn("1-9", CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
+            logger.warn(REGISTRY_FAILED_READ_WRITE_CACHE_FILE, 
CAUSE_MULTI_DUBBO_USING_SAME_FILE, "",
                 "Failed to load registry cache file " + file, e);
         }
     }
@@ -478,7 +482,7 @@ public abstract class AbstractRegistry implements Registry {
                         notify(url, listener, filterEmpty(url, urls));
                     } catch (Throwable t) {
                         // 1-7: Failed to notify registry event.
-                        logger.error("1-7", "consumer is offline", "",
+                        logger.error(REGISTRY_FAILED_NOTIFY_EVENT, "consumer 
is offline", "",
                             "Failed to notify registry event, urls: " + urls + 
", cause: " + t.getMessage(), t);
                     }
                 }
@@ -502,7 +506,7 @@ public abstract class AbstractRegistry implements Registry {
         }
         if ((CollectionUtils.isEmpty(urls)) && 
!ANY_VALUE.equals(url.getServiceInterface())) {
             // 1-4 Empty address.
-            logger.warn("1-4", "", "", "Ignore empty notify urls for subscribe 
url " + url);
+            logger.warn(REGISTRY_EMPTY_ADDRESS, "", "", "Ignore empty notify 
urls for subscribe url " + url);
             return;
         }
         if (logger.isInfoEnabled()) {
@@ -581,7 +585,7 @@ public abstract class AbstractRegistry implements Registry {
                         }
                     } catch (Throwable t) {
                         // 1-8: Failed to unregister / unsubscribe url on 
destroy.
-                        logger.warn("1-8", "", "",
+                        logger.warn(REGISTRY_FAILED_DESTROY_UNREGISTER_URL, 
"", "",
                             "Failed to unregister url " + url + " to registry 
" + getUrl() + " on destroy, cause: " + t.getMessage(), t);
                     }
                 }
@@ -599,7 +603,7 @@ public abstract class AbstractRegistry implements Registry {
                         }
                     } catch (Throwable t) {
                         // 1-8: Failed to unregister / unsubscribe url on 
destroy.
-                        logger.warn("1-8", "", "",
+                        logger.warn(REGISTRY_FAILED_DESTROY_UNREGISTER_URL, 
"", "",
                             "Failed to unsubscribe url " + url + " to registry 
" + getUrl() + " on destroy, cause: " + t.getMessage(), t);
                     }
                 }
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
index 2429822bd9..3400ac1ff1 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistryFactory.java
@@ -30,6 +30,7 @@ import org.apache.dubbo.rpc.model.ScopeModelAware;
 import static org.apache.dubbo.common.constants.CommonConstants.CHECK_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_CREATE_INSTANCE;
 import static org.apache.dubbo.rpc.cluster.Constants.EXPORT_KEY;
 import static org.apache.dubbo.rpc.cluster.Constants.REFER_KEY;
 
@@ -104,7 +105,7 @@ public abstract class AbstractRegistryFactory implements 
RegistryFactory, ScopeM
                 throw new RuntimeException("Can not create registry " + url, 
e);
             } else {
                 // 1-11 Failed to obtain or create registry (service) object.
-                LOGGER.warn("1-11", "", "",
+                LOGGER.warn(REGISTRY_FAILED_CREATE_INSTANCE, "", "",
                     "Failed to obtain or create registry ", e);
             }
         } finally {
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java
index 0a98a118fc..a6e2ee3c3d 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/CacheableFailbackRegistry.java
@@ -56,6 +56,12 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.CHECK_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.DUBBO;
 import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
 import static 
org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_SEPARATOR_ENCODED;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_ADDRESS_INVALID;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_EMPTY_ADDRESS;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_URL_EVICTING;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_PROPERTY_MISSPELLING;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_NO_PARAMETERS_URL;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_CLEAR_CACHED_URLS;
 import static org.apache.dubbo.common.constants.RegistryConstants.CATEGORY_KEY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.ENABLE_EMPTY_PROTECTION_KEY;
@@ -108,7 +114,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
             } catch (NumberFormatException e) {
                 // 0-2 Property type mismatch.
 
-                logger.warn("0-2", "typo in property value", "This property 
requires an integer value.",
+                logger.warn(COMMON_PROPERTY_MISSPELLING, "typo in property 
value", "This property requires an integer value.",
                     "Invalid registry properties configuration key " + key + 
", value " + str);
             }
         }
@@ -147,7 +153,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
             // When? FrameworkExecutorRepository gets destroyed.
 
             // 1-3: URL evicting failed.
-            logger.warn("1-3", "thread pool getting destroyed", "",
+            logger.warn(REGISTRY_FAILED_URL_EVICTING, "thread pool getting 
destroyed", "",
                 "Failed to evict url for " + url.getServiceKey(), e);
         }
     }
@@ -172,7 +178,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
                 ServiceAddressURL cachedURL = createURL(rawProvider, 
copyOfConsumer, getExtraParameters());
                 if (cachedURL == null) {
                     // 1-1: Address invalid.
-                    logger.warn("1-1", "mismatch of service group and version 
settings", "",
+                    logger.warn(REGISTRY_ADDRESS_INVALID, "mismatch of service 
group and version settings", "",
                         "Invalid address, failed to parse into URL " + 
rawProvider);
 
                     continue;
@@ -187,7 +193,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
                 if (cachedURL == null) {
                     cachedURL = createURL(rawProvider, copyOfConsumer, 
getExtraParameters());
                     if (cachedURL == null) {
-                        logger.warn("1-1", "mismatch of service group and 
version settings", "",
+                        logger.warn(REGISTRY_ADDRESS_INVALID, "mismatch of 
service group and version settings", "",
                             "Invalid address, failed to parse into URL " + 
rawProvider);
 
                         continue;
@@ -225,7 +231,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
             String category = i < 0 ? path : path.substring(i + 1);
             if (!PROVIDERS_CATEGORY.equals(category) || 
!getUrl().getParameter(ENABLE_EMPTY_PROTECTION_KEY, true)) {
                 if (PROVIDERS_CATEGORY.equals(category)) {
-                    logger.warn("1-4", "", "",
+                    logger.warn(REGISTRY_EMPTY_ADDRESS, "", "",
                         "Service " + consumer.getServiceKey() + " received 
empty address list and empty protection is disabled, will clear current 
available addresses");
                 }
                 URL empty = URLBuilder.from(consumer)
@@ -266,7 +272,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
 
         if (parts.length <= 1) {
             // 1-5 Received URL without any parameters.
-            logger.warn("1-5", "", "",
+            logger.warn(REGISTRY_NO_PARAMETERS_URL, "", "",
                 "Received url without any parameters " + rawProvider);
 
             return DubboServiceAddressURL.valueOf(rawProvider, consumerURL);
@@ -412,7 +418,7 @@ public abstract class CacheableFailbackRegistry extends 
FailbackRegistry {
             } catch (Throwable t) {
                 // 1-6 Error when clearing cached URLs.
 
-                logger.error("1-6", "", "",
+                logger.error(REGISTRY_FAILED_CLEAR_CACHED_URLS, "", "",
                     "Error occurred when clearing cached URLs", t);
 
             } finally {
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/RegistryManager.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/RegistryManager.java
index 8ff00d898c..7a2e187a3f 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/RegistryManager.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/RegistryManager.java
@@ -36,6 +36,8 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_FAILED_FETCH_INSTANCE;
+
 /**
  * Application Level, used to collect Registries
  */
@@ -125,7 +127,7 @@ public class RegistryManager {
     protected Registry getDefaultNopRegistryIfDestroyed() {
         if (destroyed.get()) {
             // 1-12 Failed to fetch (server) instance since the registry 
instances have been destroyed.
-            LOGGER.warn("1-12", "misuse of the methods", "",
+            LOGGER.warn(REGISTRY_FAILED_FETCH_INSTANCE, "misuse of the 
methods", "",
                 "All registry instances have been destroyed, failed to fetch 
any instance. " +
                 "Usually, this means no need to try to do unnecessary 
redundant resource clearance, all registries has been taken care of.");
 
diff --git 
a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
 
b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
index 3573a6537a..f5e0dc6cc2 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyClient.java
@@ -39,6 +39,9 @@ import 
org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_CLIENT_CONNECT_TIMEOUT;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CONNECT_PROVIDER;
+
 /**
  * NettyClient.
  */
@@ -127,7 +130,7 @@ public class NettyClient extends AbstractClient {
                         + getRemoteAddress() + ", error message is:" + 
cause.getMessage(), cause);
 
                 // 6-1 - Failed to connect to provider server by other reason.
-                logger.error("6-1", "network disconnected", "", "Failed to 
connect to provider server by other reason.", cause);
+                logger.error(TRANSPORT_FAILED_CONNECT_PROVIDER, "network 
disconnected", "", "Failed to connect to provider server by other reason.", 
cause);
 
                 throw remotingException;
             } else {
@@ -138,7 +141,7 @@ public class NettyClient extends AbstractClient {
                         + NetUtils.getLocalHost() + " using dubbo version " + 
Version.getVersion());
 
                 // 6-2 - Client-side timeout.
-                logger.error("6-2", "provider crash", "", "Client-side 
timeout.", remotingException);
+                logger.error(TRANSPORT_CLIENT_CONNECT_TIMEOUT, "provider 
crash", "", "Client-side timeout.", remotingException);
 
                 throw remotingException;
             }
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
index 025e902779..f664e8e7e8 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
@@ -48,6 +48,8 @@ import java.net.InetSocketAddress;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static 
org.apache.dubbo.common.constants.CommonConstants.SSL_ENABLED_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_CLIENT_CONNECT_TIMEOUT;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CONNECT_PROVIDER;
 import static org.apache.dubbo.remoting.Constants.DEFAULT_CONNECT_TIMEOUT;
 import static 
org.apache.dubbo.remoting.api.NettyEventLoopFactory.eventLoopGroup;
 import static 
org.apache.dubbo.remoting.api.NettyEventLoopFactory.socketChannelClass;
@@ -220,7 +222,7 @@ public class NettyClient extends AbstractClient {
                 RemotingException remotingException = new 
RemotingException(this, "client(url: " + getUrl() + ") failed to connect to 
server "
                         + serverAddress + ", error message is:" + 
cause.getMessage(), cause);
 
-                logger.error("6-1", "network disconnected", "",
+                logger.error(TRANSPORT_FAILED_CONNECT_PROVIDER, "network 
disconnected", "",
                     "Failed to connect to provider server by other reason.", 
cause);
 
                 throw remotingException;
@@ -234,7 +236,7 @@ public class NettyClient extends AbstractClient {
                         + getConnectTimeout() + "ms (elapsed: " + 
(System.currentTimeMillis() - start) + "ms) from netty client "
                         + NetUtils.getLocalHost() + " using dubbo version " + 
Version.getVersion());
 
-                logger.error("6-2", "provider crash", "",
+                logger.error(TRANSPORT_CLIENT_CONNECT_TIMEOUT, "provider 
crash", "",
                     "Client-side timeout.", remotingException);
 
                 throw remotingException;
diff --git 
a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
 
b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
index 604f29d38a..a3c719fc58 100644
--- 
a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
@@ -55,6 +55,7 @@ import java.util.concurrent.TimeUnit;
 
 import static org.apache.dubbo.common.constants.CommonConstants.SESSION_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CONNECT_REGISTRY;
 
 
 public class Curator5ZookeeperClient extends 
AbstractZookeeperClient<Curator5ZookeeperClient.NodeCacheListenerImpl, 
Curator5ZookeeperClient.CuratorWatcherImpl> {
@@ -99,7 +100,7 @@ public class Curator5ZookeeperClient extends 
AbstractZookeeperClient<Curator5Zoo
                 IllegalStateException illegalStateException = new 
IllegalStateException("zookeeper not connected");
 
                 // 5-1 Failed to connect to configuration center.
-                logger.error("5-1", "Zookeeper server offline", "",
+                logger.error(CONFIG_FAILED_CONNECT_REGISTRY, "Zookeeper server 
offline", "",
                     "Failed to connect with zookeeper", illegalStateException);
 
                 throw illegalStateException;
diff --git 
a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
 
b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
index 30cc4d574a..7a98cce457 100644
--- 
a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
@@ -59,6 +59,7 @@ import java.util.concurrent.TimeUnit;
 
 import static org.apache.dubbo.common.constants.CommonConstants.SESSION_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
+import static 
org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CONNECT_REGISTRY;
 
 
 public class CuratorZookeeperClient extends 
AbstractZookeeperClient<CuratorZookeeperClient.NodeCacheListenerImpl, 
CuratorZookeeperClient.CuratorWatcherImpl> {
@@ -103,7 +104,7 @@ public class CuratorZookeeperClient extends 
AbstractZookeeperClient<CuratorZooke
                 IllegalStateException illegalStateException = new 
IllegalStateException("zookeeper not connected");
 
                 // 5-1 Failed to connect to configuration center.
-                logger.error("5-1", "Zookeeper server offline", "",
+                logger.error(CONFIG_FAILED_CONNECT_REGISTRY, "Zookeeper server 
offline", "",
                     "Failed to connect with zookeeper", illegalStateException);
 
                 throw illegalStateException;

Reply via email to