You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/07/09 12:22:37 UTC

[GitHub] [dubbo] win120a opened a new pull request, #10292: [Feature] Adds feature of displaying FAQ link in logger output. / 初步添加在日志中输出 FAQ 链接的功能 #10223

win120a opened a new pull request, #10292:
URL: https://github.com/apache/dubbo/pull/10292

   ## What is the purpose of the change
   中文:
   
   为 #10223  提供一种思路。
   
   其提供一个继承于 Logger 接口的 ErrorTypeAwareLogger 接口。这个接口在记录日志时支持传入 ErrorType 对象,以确认异常的种类(可能原因)和对应的 FAQ 地址,从而能够实现在日志输出时同时附带输出对应的官网 FAQ 说明链接的功能。同时其与 Logger 接口独立,确保了向后兼容性。
   
   
   English Version: 
   
   This proposal provides a solution of #10223.
   
   It provides a interface called ErrorTypeAwareLogger, which extends Logger interface. This interface supports receiving an ErrorType instance that contains error cause and corresponding FAQ URL address. With that, the logger will also outputs a URL to instructions. It's backward-compatible since it's a seperate interface.
   
   
   ## Brief changelog
   中文:
   - 新增了一个 ErrorType,用于代表一种(类)异常,内有异常的可能原因和异常排除文档的 URL 地址。
   - 新增了一个 ErrorTypeAwareLogger 接口,用于代表支持传递 ErrorType 的日志 API。并新增了对应的 Fail-safe 实现。
   - 修改了工厂方法,使得它可以返回一个 ErrorTypeAwareLogger 对象。
   - 新增了它们对应的测试。
   
   English Version: 
   - Created a new enum called ErrorType that represents a kind of error. It contains error cause and the corresponding address of solution document.
   - ErrorTypeAwareLogger, a logger interface that receives an ErrorType. The fail-safe implementation is also added.
   - Changed the factory method of Logger. So that it can returns an instance of ErrorTypeAwareLogger.
   - Add some tests related to them.
   
   ## Verifying this change
   调用测试方法 / Invoke testing method below:
   
   `org.apache.dubbo.common.logger.support.FailsafeErrorTypeAwareLoggerTest#testInstructionShownOrNot`
   
   代码如下 / Code is here: 
   
   ```java
   @Test
   public void testInstructionShownOrNot() {
       LoggerFactory.setLoggerAdapter(FrameworkModel.defaultModel(), "jdk");
   
       ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(FailsafeErrorTypeAwareLoggerTest.class);
   
       logger.error(ErrorType.REGISTRY_CENTER_OFFLINE, "error", new Exception("error"));
   }
   ```
   
   运行可以看到输出了如下消息 / After runs, the console window prints out these message: 
   
   ```
   7月 09, 2022 6:05:10 下午 org.apache.dubbo.common.logger.jdk.JdkLogger error
   严重:  [DUBBO] error, dubbo version: , current host: (omitted). This may be caused by registry center offline, go to http://dubbo.apache.org/ to find instructions.
   java.lang.Exception: error
   ....
   ```
   
   <!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
   - [X] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
   - [ ] GitHub Actions works fine on your own branch.
   - [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] codecov-commenter commented on pull request #10292: [Feature] Adds feature of displaying FAQ link in logger output.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #10292:
URL: https://github.com/apache/dubbo/pull/10292#issuecomment-1179681441

   # [Codecov](https://codecov.io/gh/apache/dubbo/pull/10292?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#10292](https://codecov.io/gh/apache/dubbo/pull/10292?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0b9b116) into [3.1](https://codecov.io/gh/apache/dubbo/commit/7d3fb63c9fc5e0b64189cfc44e79961ae856155e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7d3fb63) will **decrease** coverage by `0.34%`.
   > The diff coverage is `72.22%`.
   
   > :exclamation: Current head 0b9b116 differs from pull request most recent head 0b60bf5. Consider uploading reports for the commit 0b60bf5 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##                3.1   #10292      +/-   ##
   ============================================
   - Coverage     65.73%   65.39%   -0.35%     
     Complexity      319      319              
   ============================================
     Files          1233     1235       +2     
     Lines         53730    53767      +37     
     Branches       8111     8081      -30     
   ============================================
   - Hits          35322    35163     -159     
   - Misses        14577    14739     +162     
   - Partials       3831     3865      +34     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo/pull/10292?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...pache/dubbo/registry/support/AbstractRegistry.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9zdXBwb3J0L0Fic3RyYWN0UmVnaXN0cnkuamF2YQ==) | `73.51% <ø> (-0.70%)` | :arrow_down: |
   | [...dubbo/remoting/zookeeper/ZookeeperTransporter.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVtb3RpbmcvZHViYm8tcmVtb3RpbmctYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZW1vdGluZy96b29rZWVwZXIvWm9va2VlcGVyVHJhbnNwb3J0ZXIuamF2YQ==) | `50.00% <0.00%> (-38.89%)` | :arrow_down: |
   | [...n/logger/support/FailsafeErrorTypeAwareLogger.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vbG9nZ2VyL3N1cHBvcnQvRmFpbHNhZmVFcnJvclR5cGVBd2FyZUxvZ2dlci5qYXZh) | `61.53% <61.53%> (ø)` | |
   | [...ava/org/apache/dubbo/rpc/model/FrameworkModel.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9ycGMvbW9kZWwvRnJhbWV3b3JrTW9kZWwuamF2YQ==) | `91.44% <66.66%> (ø)` | |
   | [...pache/dubbo/registry/support/FailbackRegistry.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9zdXBwb3J0L0ZhaWxiYWNrUmVnaXN0cnkuamF2YQ==) | `63.59% <75.00%> (ø)` | |
   | [...he/dubbo/registry/zookeeper/ZookeeperRegistry.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktem9va2VlcGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS96b29rZWVwZXIvWm9va2VlcGVyUmVnaXN0cnkuamF2YQ==) | `65.31% <80.00%> (ø)` | |
   | [...java/org/apache/dubbo/common/logger/ErrorType.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vbG9nZ2VyL0Vycm9yVHlwZS5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [.../org/apache/dubbo/common/logger/LoggerFactory.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vbG9nZ2VyL0xvZ2dlckZhY3RvcnkuamF2YQ==) | `39.70% <100.00%> (+2.78%)` | :arrow_up: |
   | [...he/dubbo/common/logger/support/FailsafeLogger.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vbG9nZ2VyL3N1cHBvcnQvRmFpbHNhZmVMb2dnZXIuamF2YQ==) | `53.17% <100.00%> (+0.37%)` | :arrow_up: |
   | [...apache/dubbo/registry/retry/AbstractRetryTask.java](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZHViYm8tcmVnaXN0cnkvZHViYm8tcmVnaXN0cnktYXBpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9yZWdpc3RyeS9yZXRyeS9BYnN0cmFjdFJldHJ5VGFzay5qYXZh) | `50.00% <100.00%> (ø)` | |
   | ... and [73 more](https://codecov.io/gh/apache/dubbo/pull/10292/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo/pull/10292?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo/pull/10292?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [7d3fb63...0b60bf5](https://codecov.io/gh/apache/dubbo/pull/10292?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ merged pull request #10292: [Feature] Adds feature of displaying FAQ link in logger output.

Posted by GitBox <gi...@apache.org>.
AlbumenJ merged PR #10292:
URL: https://github.com/apache/dubbo/pull/10292


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] win120a commented on a diff in pull request #10292: [Feature] Adds feature of displaying FAQ link in logger output.

Posted by GitBox <gi...@apache.org>.
win120a commented on code in PR #10292:
URL: https://github.com/apache/dubbo/pull/10292#discussion_r917358268


##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/ErrorType.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.logger;
+
+/**
+ * Represents an error type, which can be displayed by the logger like:
+ * ".... This may be caused by [error cause], go to [URL] to find instructions."
+ */
+public enum ErrorType {
+
+    // Temporarily empty. The only one entry is for testing.
+    REGISTRY_CENTER_OFFLINE("registry center offline", "http://dubbo.apache.org/");
+
+    /**
+     * Error cause.
+     */
+    private final String cause;
+
+    /**
+     * Link to instructions.
+     */
+    private final String errorUrl;

Review Comment:
   “需要扩展一个字端在报错的时候可以自定义透出一些信息” 这个是怎么放来着?
   比如这样? ".... This may be caused by [error cause], go to [URL] to find instructions. [自定义信息]"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10292: [Feature] Adds feature of displaying FAQ link in logger output.

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10292:
URL: https://github.com/apache/dubbo/pull/10292#discussion_r917356533


##########
dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistry.java:
##########
@@ -150,8 +150,8 @@ public void doSubscribe(final URL url, final NotifyListener listener) {
                 String root = toRootPath();
                 boolean check = url.getParameter(CHECK_KEY, false);
                 ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.computeIfAbsent(url, k -> new ConcurrentHashMap<>());
-                ChildListener zkListener = listeners.computeIfAbsent(listener, k -> (parentPath, currentChilds) -> {
-                    for (String child : currentChilds) {
+                ChildListener zkListener = listeners.computeIfAbsent(listener, k -> (parentPath, currentChildren) -> {
+                    for (String child : currentChildren) {
                         child = URL.decode(child);
                         if (!anyServices.contains(child)) {

Review Comment:
   无关修改还原回去



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] win120a commented on a diff in pull request #10292: [Feature] Adds feature of displaying FAQ link in logger output.

Posted by GitBox <gi...@apache.org>.
win120a commented on code in PR #10292:
URL: https://github.com/apache/dubbo/pull/10292#discussion_r917358480


##########
dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/ZookeeperRegistry.java:
##########
@@ -150,8 +150,8 @@ public void doSubscribe(final URL url, final NotifyListener listener) {
                 String root = toRootPath();
                 boolean check = url.getParameter(CHECK_KEY, false);
                 ConcurrentMap<NotifyListener, ChildListener> listeners = zkListeners.computeIfAbsent(url, k -> new ConcurrentHashMap<>());
-                ChildListener zkListener = listeners.computeIfAbsent(listener, k -> (parentPath, currentChilds) -> {
-                    for (String child : currentChilds) {
+                ChildListener zkListener = listeners.computeIfAbsent(listener, k -> (parentPath, currentChildren) -> {
+                    for (String child : currentChildren) {
                         child = URL.decode(child);
                         if (!anyServices.contains(child)) {

Review Comment:
   不知道怎么就混了进来…… 我并没有动这里……



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10292: [Feature] Adds feature of displaying FAQ link in logger output.

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on code in PR #10292:
URL: https://github.com/apache/dubbo/pull/10292#discussion_r917355912


##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/ErrorType.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.logger;
+
+/**
+ * Represents an error type, which can be displayed by the logger like:
+ * ".... This may be caused by [error cause], go to [URL] to find instructions."
+ */
+public enum ErrorType {
+
+    // Temporarily empty. The only one entry is for testing.
+    REGISTRY_CENTER_OFFLINE("registry center offline", "http://dubbo.apache.org/");

Review Comment:
   具体报错的信息不要带有官网地址,把官网地址抽成一个静态变量



##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/ErrorType.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.logger;
+
+/**
+ * Represents an error type, which can be displayed by the logger like:
+ * ".... This may be caused by [error cause], go to [URL] to find instructions."
+ */
+public enum ErrorType {
+
+    // Temporarily empty. The only one entry is for testing.
+    REGISTRY_CENTER_OFFLINE("registry center offline", "http://dubbo.apache.org/");
+
+    /**
+     * Error cause.
+     */
+    private final String cause;
+
+    /**
+     * Link to instructions.
+     */
+    private final String errorUrl;

Review Comment:
   这里需要有错误码,类似 1-1,1-2 这种(第一位是报错类型,第二位是报错序号)
   
   报错类型是类似“注册中心”、“路由” 这种



##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/ErrorType.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.logger;
+
+/**
+ * Represents an error type, which can be displayed by the logger like:
+ * ".... This may be caused by [error cause], go to [URL] to find instructions."
+ */
+public enum ErrorType {
+
+    // Temporarily empty. The only one entry is for testing.
+    REGISTRY_CENTER_OFFLINE("registry center offline", "http://dubbo.apache.org/");
+
+    /**
+     * Error cause.
+     */
+    private final String cause;
+
+    /**
+     * Link to instructions.
+     */
+    private final String errorUrl;

Review Comment:
   FAQ链接基于报错码自动生成



##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/support/FailsafeErrorTypeAwareLogger.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * 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.logger.support;
+
+import org.apache.dubbo.common.Version;
+import org.apache.dubbo.common.logger.ErrorType;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.utils.NetUtils;
+
+/**
+ * A fail-safe (ignoring exception thrown by logger) wrapper of error type aware logger.
+ */
+public class FailsafeErrorTypeAwareLogger extends FailsafeLogger implements ErrorTypeAwareLogger {
+
+    public FailsafeErrorTypeAwareLogger(Logger logger) {
+        super(logger);
+    }
+
+    private String appendContextMessageWithInstructions(ErrorType errorType, String msg) {
+        return " [DUBBO] " + msg + ", dubbo version: " + Version.getVersion() +

Review Comment:
   报错码这里需要输出



##########
dubbo-common/src/main/java/org/apache/dubbo/common/logger/ErrorType.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.logger;
+
+/**
+ * Represents an error type, which can be displayed by the logger like:
+ * ".... This may be caused by [error cause], go to [URL] to find instructions."
+ */
+public enum ErrorType {
+
+    // Temporarily empty. The only one entry is for testing.
+    REGISTRY_CENTER_OFFLINE("registry center offline", "http://dubbo.apache.org/");
+
+    /**
+     * Error cause.
+     */
+    private final String cause;
+
+    /**
+     * Link to instructions.
+     */
+    private final String errorUrl;

Review Comment:
   需要扩展一个字端在报错的时候可以自定义透出一些信息



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org