You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by to...@apache.org on 2022/05/11 03:44:56 UTC

[shardingsphere] branch master updated: Bridges error logs which printed by ShardingSphereEventBus to slf4j (#17541)

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

totalo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new a78a843d93c Bridges error logs which printed by ShardingSphereEventBus to slf4j (#17541)
a78a843d93c is described below

commit a78a843d93cf24b3cd2af3d94ee3b8e79187807d
Author: 吴伟杰 <wu...@apache.org>
AuthorDate: Wed May 11 11:44:48 2022 +0800

    Bridges error logs which printed by ShardingSphereEventBus to slf4j (#17541)
    
    * Bridge error logs from jul to slf4j
    
    * Add LICENSE for jul-to-slf4j
---
 pom.xml                                                             | 4 ++++
 .../shardingsphere-proxy-distribution/src/main/release-docs/LICENSE | 1 +
 .../shardingsphere/infra/eventbus/ShardingSphereEventBus.java       | 6 ++++++
 3 files changed, 11 insertions(+)

diff --git a/pom.xml b/pom.xml
index 9f8d5870a33..28dccea780a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -762,6 +762,10 @@
             <groupId>org.slf4j</groupId>
             <artifactId>jcl-over-slf4j</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jul-to-slf4j</artifactId>
+        </dependency>
         <dependency>
             <groupId>ch.qos.logback</groupId>
             <artifactId>logback-classic</artifactId>
diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/release-docs/LICENSE b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/release-docs/LICENSE
index bd93aec6f94..2bdb231640c 100644
--- a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/release-docs/LICENSE
+++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/release-docs/LICENSE
@@ -354,4 +354,5 @@ The text of each license is also included at licenses/LICENSE-[project].txt.
     animal-sniffer-annotations 1.18: https://github.com/mojohaus/animal-sniffer, MIT
     bcprov-jdk15on 1.70: https://www.bouncycastle.org, MIT
     checker-qual 3.5.0: https://github.com/typetools/checker-framework/blob/master/checker-qual, MIT
+    jul-to-slf4j 1.7.7: https://www.slf4j.org, MIT
     slf4j 1.7.7: https://www.slf4j.org , MIT
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java
index 67651dade0a..640711f5e34 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/eventbus/ShardingSphereEventBus.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.infra.eventbus;
 import com.google.common.eventbus.EventBus;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import org.slf4j.bridge.SLF4JBridgeHandler;
 
 /**
  * ShardingSphere event bus.
@@ -38,6 +39,11 @@ public final class ShardingSphereEventBus {
     
     private static final class ShardingSphereEventBusHolder {
         
+        static {
+            SLF4JBridgeHandler.removeHandlersForRootLogger();
+            SLF4JBridgeHandler.install();
+        }
+        
         private static final EventBus INSTANCE = new EventBus();
     }
 }