You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/02/10 08:26:24 UTC

[shardingsphere] branch master updated: Disable logging rule default builder (#24102)

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

jianglongtao 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 c88d5c27ecd Disable logging rule default builder (#24102)
c88d5c27ecd is described below

commit c88d5c27ecd4b35ffda692edad9594487a1d34b5
Author: ChenJiaHao <Pa...@163.com>
AuthorDate: Fri Feb 10 16:26:16 2023 +0800

    Disable logging rule default builder (#24102)
    
    * Disable logging rule default builder
    
    * Add LoggingRule exists check
---
 .../main/java/org/apache/shardingsphere/logging/utils/LoggingUtils.java | 2 +-
 ...here.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/utils/LoggingUtils.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/utils/LoggingUtils.java
index fffbb6b3abc..ddac0d004e2 100644
--- a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/utils/LoggingUtils.java
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/utils/LoggingUtils.java
@@ -58,7 +58,7 @@ public class LoggingUtils {
      * @return ShardingSphere-SQL logger
      */
     public static Optional<ShardingSphereLogger> getSQLLogger(final ShardingSphereRuleMetaData globalRuleMetaData) {
-        return getSQLLogger(globalRuleMetaData.getSingleRule(LoggingRule.class).getConfiguration());
+        return globalRuleMetaData.findSingleRule(LoggingRule.class).isPresent() ? getSQLLogger(globalRuleMetaData.getSingleRule(LoggingRule.class).getConfiguration()) : Optional.empty();
     }
     
     /**
diff --git a/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder
index a48557a0a7b..c3a79c9a109 100644
--- a/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder
+++ b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder
+#org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder