You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/05/26 09:47:46 UTC

[dubbo] branch 3.0 updated: Avoid logger being set multiple times.

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

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


The following commit(s) were added to refs/heads/3.0 by this push:
     new 04f10d3  Avoid logger being set multiple times.
04f10d3 is described below

commit 04f10d3dd3311e08ba8eea755872cf2a98faca7e
Author: ken.lj <ke...@gmail.com>
AuthorDate: Wed May 26 17:46:42 2021 +0800

    Avoid logger being set multiple times.
---
 .../src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java b/dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java
index 41d1632..58cbc46 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/logger/LoggerFactory.java
@@ -92,6 +92,9 @@ public class LoggerFactory {
      */
     public static void setLoggerAdapter(LoggerAdapter loggerAdapter) {
         if (loggerAdapter != null) {
+            if (loggerAdapter == LOGGER_ADAPTER) {
+                return;
+            }
             Logger logger = loggerAdapter.getLogger(LoggerFactory.class.getName());
             logger.info("using logger: " + loggerAdapter.getClass().getName());
             LoggerFactory.LOGGER_ADAPTER = loggerAdapter;