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/09 10:34:49 UTC

[shardingsphere] branch master updated: Add logging module, make log configuration into global rule (#24046)

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 ec4b3210556 Add logging module, make log configuration into global rule (#24046)
ec4b3210556 is described below

commit ec4b3210556a22ebe2354c720987ad6b62739b95
Author: ChenJiaHao <Pa...@163.com>
AuthorDate: Thu Feb 9 18:34:37 2023 +0800

    Add logging module, make log configuration into global rule (#24046)
    
    * Add logging module, add log configuration to global rule
    
    * Improved log configuration,mark sql-show as deprecated
    
    * Sync sql-show and logging rule
    
    * Update server.yaml
    
    * Improve sync props and logging rule
    
    * Remove deprecated comment of sql-show
    
    * Fix CI
    
    * Improve SHOW DIST VARIABLE
    
    * rename method
    
    * Add logging constant
    
    * Fix UT
    
    * Update logback default configuration
    
    * Fix code style
    
    * Improve SHOW DIST VARIABLE | VARIABLES
    
    * Fix SHOW DIST VARIABLES
    
    * Fix unit test
    
    * Resolve conflict
    
    * Resolve conflict
    
    * Add todo
    
    * Fix comment
    
    * Optimize code
    
    * Revise comment
    
    * Fix codestyle
    
    * Fix UT
    
    * Fix codestyle
    
    * Add logging rule test case
    
    * extract LoggingUtils
    
    * Update default server.yaml
    
    * Fix javadoc
---
 infra/context/pom.xml                              |   5 +
 .../infra/context/kernel/KernelProcessor.java      |  23 ++-
 .../infra/context/kernel/KernelProcessorTest.java  |  15 +-
 .../infra/executor/sql/log/SQLLogger.java          |   2 +-
 jdbc/core/pom.xml                                  |   5 +
 kernel/{ => logging/api}/pom.xml                   |  24 ++-
 .../logging/config/LoggingRuleConfiguration.java   |  38 +++++
 .../logging/logger/ShardingSphereAppender.java     |  39 +++++
 .../logging/logger/ShardingSphereLogger.java       |  43 +++++
 kernel/{ => logging/core}/pom.xml                  |  30 ++--
 .../logging/constant/LoggingConstants.java         |  39 +++++
 .../logging/constant/LoggingOrder.java             |  33 ++++
 .../shardingsphere/logging/rule/LoggingRule.java   |  40 +++++
 .../DefaultLoggingRuleConfigurationBuilder.java    |  98 ++++++++++++
 .../logging/rule/builder/LoggingRuleBuilder.java   |  52 ++++++
 .../shardingsphere/logging/utils/LoggingUtils.java | 174 +++++++++++++++++++++
 .../yaml/config/YamlAppenderConfiguration.java     |  42 +++++
 .../YamlAppendersConfigurationConverter.java       |  55 +++++++
 .../yaml/config/YamlLoggerConfiguration.java       |  46 ++++++
 .../config/YamlLoggersConfigurationConverter.java  |  55 +++++++
 .../yaml/config/YamlLoggingRuleConfiguration.java  |  43 +++++
 .../logging/yaml/swapper/YamlAppenderSwapper.java  |  48 ++++++
 .../logging/yaml/swapper/YamlLoggerSwapper.java    |  48 ++++++
 .../YamlLoggingRuleConfigurationSwapper.java       |  65 ++++++++
 ...er.global.DefaultGlobalRuleConfigurationBuilder |  18 +++
 ...ere.infra.rule.builder.global.GlobalRuleBuilder |  18 +++
 ...onfig.swapper.rule.YamlRuleConfigurationSwapper |  18 +++
 .../logging/rule/LoggingRuleTest.java              |  51 ++++++
 ...DefaultLoggingRuleConfigurationBuilderTest.java |  34 ++++
 .../YamlLoggingRuleConfigurationSwapperTest.java   |  68 ++++++++
 kernel/logging/core/src/test/resources/logback.xml |  39 +++++
 kernel/{ => logging}/pom.xml                       |  16 +-
 kernel/pom.xml                                     |   1 +
 .../mode/metadata/MetaDataContexts.java            |   1 +
 .../ConfigurationChangedSubscriberTest.java        |   4 +-
 proxy/backend/pom.xml                              |   5 +
 .../backend/config/ProxyConfigurationLoader.java   |   3 +
 .../config/yaml/YamlProxyServerConfiguration.java  |   3 +
 .../ral/queryable/ShowDistVariableExecutor.java    |  29 +++-
 .../ral/queryable/ShowDistVariablesExecutor.java   |  22 ++-
 .../ral/updatable/SetDistVariableHandler.java      |  22 +++
 .../queryable/ShowDistVariableExecutorTest.java    |   5 +
 .../queryable/ShowDistVariablesExecutorTest.java   |   5 +
 .../proxy/config/LogbackConfiguration.java         |   7 +-
 .../bootstrap/src/main/resources/conf/server.yaml  |   9 ++
 .../shardingsphere/proxy/config/LogbackTest.java   |   1 -
 .../query/MySQLComQueryPacketExecutorTest.java     |   5 +-
 .../query/MySQLMultiStatementsHandlerTest.java     |   5 +-
 .../bind/OpenGaussComBatchBindExecutorTest.java    |   6 +-
 ...egatedBatchedStatementsCommandExecutorTest.java |   8 +-
 .../PostgreSQLBatchedStatementsExecutorTest.java   |   5 +-
 .../PostgreSQLComDescribeExecutorTest.java         |   7 +-
 52 files changed, 1411 insertions(+), 66 deletions(-)

diff --git a/infra/context/pom.xml b/infra/context/pom.xml
index a4b50e2a140..4d953c382e4 100644
--- a/infra/context/pom.xml
+++ b/infra/context/pom.xml
@@ -48,6 +48,11 @@
             <artifactId>shardingsphere-authority-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-logging-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-transaction-core</artifactId>
diff --git a/infra/context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java b/infra/context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java
index a1448ff69c9..fcf2756b9f7 100644
--- a/infra/context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java
+++ b/infra/context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java
@@ -30,6 +30,12 @@ import org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry;
 import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteResult;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.route.engine.SQLRouteEngine;
+import org.apache.shardingsphere.logging.constant.LoggingConstants;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.utils.LoggingUtils;
+
+import java.util.Optional;
+import java.util.Properties;
 
 /**
  * Kernel processor.
@@ -51,7 +57,7 @@ public final class KernelProcessor {
         RouteContext routeContext = route(queryContext, database, globalRuleMetaData, props, connectionContext);
         SQLRewriteResult rewriteResult = rewrite(queryContext, database, globalRuleMetaData, props, routeContext, connectionContext);
         ExecutionContext result = createExecutionContext(queryContext, database, routeContext, rewriteResult);
-        logSQL(queryContext, props, result);
+        logSQL(queryContext, globalRuleMetaData, props, result);
         return result;
     }
     
@@ -70,9 +76,20 @@ public final class KernelProcessor {
         return new ExecutionContext(queryContext, ExecutionContextBuilder.build(database, rewriteResult, queryContext.getSqlStatementContext()), routeContext);
     }
     
-    private void logSQL(final QueryContext queryContext, final ConfigurationProperties props, final ExecutionContext executionContext) {
-        if (props.<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)) {
+    private void logSQL(final QueryContext queryContext, final ShardingSphereRuleMetaData globalRuleMetaData, final ConfigurationProperties props, final ExecutionContext executionContext) {
+        Optional<ShardingSphereLogger> sqlLogger = LoggingUtils.getSQLLogger(globalRuleMetaData);
+        if (sqlLogger.isPresent() && sqlLogger.get().getProps().containsKey(LoggingConstants.SQL_LOG_ENABLE)) {
+            logSQL(queryContext, executionContext, sqlLogger.get());
+        } else if (props.<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)) {
             SQLLogger.logSQL(queryContext, props.<Boolean>getValue(ConfigurationPropertyKey.SQL_SIMPLE), executionContext);
         }
     }
+    
+    private void logSQL(final QueryContext queryContext, final ExecutionContext executionContext, final ShardingSphereLogger sqlLogger) {
+        Properties loggerProps = sqlLogger.getProps();
+        if (loggerProps.containsKey(LoggingConstants.SQL_LOG_ENABLE) && Boolean.parseBoolean(loggerProps.get(LoggingConstants.SQL_LOG_ENABLE).toString())) {
+            SQLLogger.logSQL(queryContext, loggerProps.containsKey(LoggingConstants.SQL_LOG_SIMPLE) && Boolean.parseBoolean(loggerProps.get(LoggingConstants.SQL_SIMPLE).toString()),
+                    executionContext);
+        }
+    }
 }
diff --git a/infra/context/src/test/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessorTest.java b/infra/context/src/test/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessorTest.java
index fa7a91f6c80..e93b24365a3 100644
--- a/infra/context/src/test/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessorTest.java
+++ b/infra/context/src/test/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessorTest.java
@@ -29,6 +29,8 @@ import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.database.resource.ShardingSphereResourceMetaData;
 import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 import org.apache.shardingsphere.sqltranslator.rule.SQLTranslatorRule;
@@ -36,7 +38,9 @@ import org.apache.shardingsphere.test.util.PropertiesBuilder;
 import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
 import org.junit.Test;
 
+import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedList;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -53,10 +57,17 @@ public final class KernelProcessorTest {
         when(sqlStatementContext.getSqlStatement()).thenReturn(mock(SelectStatement.class));
         QueryContext queryContext = new QueryContext(sqlStatementContext, "SELECT * FROM tbl", Collections.emptyList());
         ShardingSphereDatabase database = new ShardingSphereDatabase(DefaultDatabase.LOGIC_NAME, mock(DatabaseType.class),
-                mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(Collections.singleton(mock(SQLTranslatorRule.class))), Collections.emptyMap());
+                mock(ShardingSphereResourceMetaData.class, RETURNS_DEEP_STUBS), new ShardingSphereRuleMetaData(mockShardingSphereRule()), Collections.emptyMap());
         ConfigurationProperties props = new ConfigurationProperties(PropertiesBuilder.build(new Property(ConfigurationPropertyKey.SQL_SHOW.getKey(), Boolean.TRUE.toString())));
-        ExecutionContext actual = new KernelProcessor().generateExecutionContext(queryContext, database, new ShardingSphereRuleMetaData(Collections.singleton(mock(SQLTranslatorRule.class))), props,
+        ExecutionContext actual = new KernelProcessor().generateExecutionContext(queryContext, database, new ShardingSphereRuleMetaData(mockShardingSphereRule()), props,
                 mock(ConnectionContext.class));
         assertThat(actual.getExecutionUnits().size(), is(1));
     }
+    
+    private Collection<ShardingSphereRule> mockShardingSphereRule() {
+        Collection<ShardingSphereRule> result = new LinkedList<>();
+        result.add(mock(SQLTranslatorRule.class));
+        result.add(mock(LoggingRule.class, RETURNS_DEEP_STUBS));
+        return result;
+    }
 }
diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLogger.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLogger.java
index ac991bf1c9e..97f0e63db56 100644
--- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLogger.java
+++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLogger.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.infra.executor.sql.log;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.infra.binder.QueryContext;
 import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
 import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
-import org.apache.shardingsphere.infra.binder.QueryContext;
 
 import java.util.Collection;
 import java.util.HashSet;
diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml
index 50f96270169..b8d153a48da 100644
--- a/jdbc/core/pom.xml
+++ b/jdbc/core/pom.xml
@@ -80,6 +80,11 @@
             <artifactId>shardingsphere-authority-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-logging-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-single-core</artifactId>
diff --git a/kernel/pom.xml b/kernel/logging/api/pom.xml
similarity index 71%
copy from kernel/pom.xml
copy to kernel/logging/api/pom.xml
index 75c3a4101dd..d1fddaa9817 100644
--- a/kernel/pom.xml
+++ b/kernel/logging/api/pom.xml
@@ -21,23 +21,17 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere</artifactId>
+        <artifactId>shardingsphere-logging</artifactId>
         <version>5.3.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-kernel</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-logging-api</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>parser</module>
-        <module>single</module>
-        <module>authority</module>
-        <module>transaction</module>
-        <module>time-service</module>
-        <module>schedule</module>
-        <module>data-pipeline</module>
-        <module>sql-federation</module>
-        <module>sql-translator</module>
-        <module>traffic</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-infra-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/config/LoggingRuleConfiguration.java b/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/config/LoggingRuleConfiguration.java
new file mode 100644
index 00000000000..42d0ab38e62
--- /dev/null
+++ b/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/config/LoggingRuleConfiguration.java
@@ -0,0 +1,38 @@
+/*
+ * 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.shardingsphere.logging.config;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.config.rule.scope.GlobalRuleConfiguration;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+
+import java.util.Collection;
+
+/**
+ * Logging rule configuration.
+ */
+@Getter
+@RequiredArgsConstructor
+public final class LoggingRuleConfiguration implements GlobalRuleConfiguration {
+    
+    private final Collection<ShardingSphereLogger> loggers;
+    
+    private final Collection<ShardingSphereAppender> appenders;
+}
diff --git a/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/logger/ShardingSphereAppender.java b/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/logger/ShardingSphereAppender.java
new file mode 100644
index 00000000000..fb1f5386126
--- /dev/null
+++ b/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/logger/ShardingSphereAppender.java
@@ -0,0 +1,39 @@
+/*
+ * 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.shardingsphere.logging.logger;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+
+/**
+ * ShardingSphere appender.
+ */
+@Getter
+@RequiredArgsConstructor
+public final class ShardingSphereAppender {
+    
+    private final String appenderName;
+    
+    private final String appenderClass;
+    
+    private final String pattern;
+    
+    @Setter
+    private String file;
+}
diff --git a/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/logger/ShardingSphereLogger.java b/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/logger/ShardingSphereLogger.java
new file mode 100644
index 00000000000..c3bf04f45b2
--- /dev/null
+++ b/kernel/logging/api/src/main/java/org/apache/shardingsphere/logging/logger/ShardingSphereLogger.java
@@ -0,0 +1,43 @@
+/*
+ * 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.shardingsphere.logging.logger;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+
+import java.util.Properties;
+
+/**
+ * ShardingSphere logger.
+ */
+@Getter
+@RequiredArgsConstructor
+public final class ShardingSphereLogger {
+    
+    private final String loggerName;
+    
+    private final String level;
+    
+    private final Boolean additivity;
+    
+    private final String appenderName;
+    
+    @Setter
+    private Properties props = new Properties();
+}
diff --git a/kernel/pom.xml b/kernel/logging/core/pom.xml
similarity index 70%
copy from kernel/pom.xml
copy to kernel/logging/core/pom.xml
index 75c3a4101dd..204396624f0 100644
--- a/kernel/pom.xml
+++ b/kernel/logging/core/pom.xml
@@ -21,23 +21,23 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere</artifactId>
+        <artifactId>shardingsphere-logging</artifactId>
         <version>5.3.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-kernel</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-logging-core</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>parser</module>
-        <module>single</module>
-        <module>authority</module>
-        <module>transaction</module>
-        <module>time-service</module>
-        <module>schedule</module>
-        <module>data-pipeline</module>
-        <module>sql-federation</module>
-        <module>sql-translator</module>
-        <module>traffic</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-logging-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
 </project>
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/constant/LoggingConstants.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/constant/LoggingConstants.java
new file mode 100644
index 00000000000..de8f1d0fe3f
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/constant/LoggingConstants.java
@@ -0,0 +1,39 @@
+/*
+ * 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.shardingsphere.logging.constant;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class LoggingConstants {
+    
+    public static final String SQL_SHOW = "sql-show";
+    
+    public static final String SQL_SIMPLE = "sql-simple";
+    
+    public static final String SQL_LOG_TOPIC = "ShardingSphere-SQL";
+    
+    public static final String SQL_LOG_ENABLE = "enable";
+    
+    public static final String SQL_LOG_SIMPLE = "simple";
+    
+    public static final String SQL_SHOW_VARIABLE_NAME = "sql_show";
+    
+    public static final String SQL_SIMPLE_VARIABLE_NAME = "sql_simple";
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/constant/LoggingOrder.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/constant/LoggingOrder.java
new file mode 100644
index 00000000000..f9208c68ab8
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/constant/LoggingOrder.java
@@ -0,0 +1,33 @@
+/*
+ * 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.shardingsphere.logging.constant;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+/**
+ * Logging order.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class LoggingOrder {
+    
+    /**
+     * Logging order.
+     */
+    public static final int ORDER = 9100;
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/LoggingRule.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/LoggingRule.java
new file mode 100644
index 00000000000..7461dcdbe77
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/LoggingRule.java
@@ -0,0 +1,40 @@
+/*
+ * 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.shardingsphere.logging.rule;
+
+import lombok.Getter;
+import org.apache.shardingsphere.infra.rule.identifier.scope.GlobalRule;
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+
+/**
+ * Logging rule.
+ */
+public final class LoggingRule implements GlobalRule {
+    
+    @Getter
+    private final LoggingRuleConfiguration configuration;
+    
+    public LoggingRule(final LoggingRuleConfiguration ruleConfig) {
+        configuration = ruleConfig;
+    }
+    
+    @Override
+    public String getType() {
+        return LoggingRule.class.getSimpleName();
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/builder/DefaultLoggingRuleConfigurationBuilder.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/builder/DefaultLoggingRuleConfigurationBuilder.java
new file mode 100644
index 00000000000..5afbbd4648b
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/builder/DefaultLoggingRuleConfigurationBuilder.java
@@ -0,0 +1,98 @@
+/*
+ * 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.shardingsphere.logging.rule.builder;
+
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.PatternLayout;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.FileAppender;
+import ch.qos.logback.core.OutputStreamAppender;
+import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
+import org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder;
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.constant.LoggingOrder;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+
+/**
+ * Default logging rule configuration builder.
+ */
+public final class DefaultLoggingRuleConfigurationBuilder implements DefaultGlobalRuleConfigurationBuilder<LoggingRuleConfiguration, LoggingRuleBuilder> {
+    
+    @Override
+    public LoggingRuleConfiguration build() {
+        LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
+        return new LoggingRuleConfiguration(getDefaultLoggers(loggerContext), getDefaultAppenders(loggerContext));
+    }
+    
+    private Collection<ShardingSphereLogger> getDefaultLoggers(final LoggerContext loggerContext) {
+        return loggerContext.getLoggerList().stream().filter(each -> Objects.nonNull(each.getLevel())).filter(each -> !Logger.ROOT_LOGGER_NAME.equalsIgnoreCase(each.getName()))
+                .map(each -> new ShardingSphereLogger(each.getName(), each.getLevel().levelStr, each.isAdditive(),
+                        each.iteratorForAppenders().hasNext() ? each.iteratorForAppenders().next().getName() : null))
+                .collect(Collectors.toList());
+    }
+    
+    private Collection<ShardingSphereAppender> getDefaultAppenders(final LoggerContext loggerContext) {
+        return loggerContext.getLoggerList().stream().filter(each -> Objects.nonNull(each.getLevel())).filter(each -> !Logger.ROOT_LOGGER_NAME.equalsIgnoreCase(each.getName())).map(each -> {
+            Iterator<Appender<ILoggingEvent>> appenderIterator = each.iteratorForAppenders();
+            if (appenderIterator.hasNext()) {
+                Appender<ILoggingEvent> appender = appenderIterator.next();
+                ShardingSphereAppender shardingSphereAppender = new ShardingSphereAppender(appender.getName(), appender.getClass().getName(), getAppenderPattern(appender));
+                getFileOutput(appender, shardingSphereAppender);
+                return shardingSphereAppender;
+            }
+            return null;
+        }).filter(Objects::nonNull).collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ShardingSphereAppender::getAppenderName))));
+    }
+    
+    private String getAppenderPattern(final Appender<ILoggingEvent> appender) {
+        if (appender instanceof OutputStreamAppender) {
+            OutputStreamAppender<ILoggingEvent> consoleAppender = (OutputStreamAppender<ILoggingEvent>) appender;
+            LayoutWrappingEncoder<ILoggingEvent> encoder = (LayoutWrappingEncoder<ILoggingEvent>) consoleAppender.getEncoder();
+            PatternLayout layout = (PatternLayout) encoder.getLayout();
+            return layout.getPattern();
+        }
+        return "";
+    }
+    
+    private void getFileOutput(final Appender<ILoggingEvent> appender, final ShardingSphereAppender shardingSphereAppender) {
+        if (appender instanceof FileAppender) {
+            shardingSphereAppender.setFile(((FileAppender<ILoggingEvent>) appender).getFile());
+        }
+    }
+    
+    @Override
+    public int getOrder() {
+        return LoggingOrder.ORDER;
+    }
+    
+    @Override
+    public Class<LoggingRuleBuilder> getTypeClass() {
+        return LoggingRuleBuilder.class;
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/builder/LoggingRuleBuilder.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/builder/LoggingRuleBuilder.java
new file mode 100644
index 00000000000..da8e313899e
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/rule/builder/LoggingRuleBuilder.java
@@ -0,0 +1,52 @@
+/*
+ * 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.shardingsphere.logging.rule.builder;
+
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
+import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder;
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.constant.LoggingOrder;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.utils.LoggingUtils;
+
+import java.util.Map;
+
+/**
+ * Logging rule builder.
+ */
+public final class LoggingRuleBuilder implements GlobalRuleBuilder<LoggingRuleConfiguration> {
+    
+    @Override
+    public LoggingRule build(final LoggingRuleConfiguration ruleConfig, final Map<String, ShardingSphereDatabase> databases, final ConfigurationProperties props) {
+        LoggingUtils.syncLoggingConfig(ruleConfig, props);
+        // TODO skip this while instance type is JDBC
+        LoggingUtils.refreshLogger(ruleConfig);
+        return new LoggingRule(ruleConfig);
+    }
+    
+    @Override
+    public int getOrder() {
+        return LoggingOrder.ORDER;
+    }
+    
+    @Override
+    public Class<LoggingRuleConfiguration> getTypeClass() {
+        return LoggingRuleConfiguration.class;
+    }
+}
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
new file mode 100644
index 00000000000..fffbb6b3abc
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/utils/LoggingUtils.java
@@ -0,0 +1,174 @@
+/*
+ * 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.shardingsphere.logging.utils;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.FileAppender;
+import ch.qos.logback.core.OutputStreamAppender;
+import ch.qos.logback.core.util.DynamicClassLoadingException;
+import ch.qos.logback.core.util.IncompatibleClassException;
+import ch.qos.logback.core.util.OptionHelper;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
+import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.constant.LoggingConstants;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Optional;
+import java.util.Properties;
+
+/**
+ * Logging utils.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class LoggingUtils {
+    
+    /**
+     * Get ShardingSphere-SQL logger.
+     *
+     * @param globalRuleMetaData ShardingSphere global rule metaData
+     * @return ShardingSphere-SQL logger
+     */
+    public static Optional<ShardingSphereLogger> getSQLLogger(final ShardingSphereRuleMetaData globalRuleMetaData) {
+        return getSQLLogger(globalRuleMetaData.getSingleRule(LoggingRule.class).getConfiguration());
+    }
+    
+    /**
+     * Get ShardingSphere-SQL logger.
+     *
+     * @param loggingRuleConfiguration logging global rule configuration
+     * @return ShardingSphere-SQL logger
+     */
+    public static Optional<ShardingSphereLogger> getSQLLogger(final LoggingRuleConfiguration loggingRuleConfiguration) {
+        return loggingRuleConfiguration.getLoggers().stream()
+                .filter(each -> LoggingConstants.SQL_LOG_TOPIC.equalsIgnoreCase(each.getLoggerName())).findFirst();
+    }
+    
+    /**
+     * Synchronize the log-related configuration in logging rule and props.
+     * Use the configuration in the logging rule first.
+     *
+     * @param loggingRuleConfiguration logging global rule configuration
+     * @param props configuration properties
+     */
+    public static void syncLoggingConfig(final LoggingRuleConfiguration loggingRuleConfiguration, final ConfigurationProperties props) {
+        LoggingUtils.getSQLLogger(loggingRuleConfiguration).ifPresent(option -> {
+            Properties loggerProperties = option.getProps();
+            syncPropsToLoggingRule(loggerProperties, props);
+            syncLoggingRuleToProps(loggerProperties, props);
+        });
+    }
+    
+    private static void syncPropsToLoggingRule(final Properties loggerProperties, final ConfigurationProperties props) {
+        if (!loggerProperties.containsKey(LoggingConstants.SQL_LOG_ENABLE) && props.getProps().containsKey(LoggingConstants.SQL_SHOW)) {
+            loggerProperties.setProperty(LoggingConstants.SQL_LOG_ENABLE, props.getProps().get(LoggingConstants.SQL_SHOW).toString());
+        }
+        if (!loggerProperties.containsKey(LoggingConstants.SQL_LOG_SIMPLE) && props.getProps().containsKey(LoggingConstants.SQL_SIMPLE)) {
+            loggerProperties.setProperty(LoggingConstants.SQL_LOG_SIMPLE, props.getProps().get(LoggingConstants.SQL_SIMPLE).toString());
+        }
+    }
+    
+    private static void syncLoggingRuleToProps(final Properties loggerProperties, final ConfigurationProperties props) {
+        if (loggerProperties.containsKey(LoggingConstants.SQL_LOG_ENABLE)) {
+            props.getProps().setProperty(LoggingConstants.SQL_SHOW, loggerProperties.get(LoggingConstants.SQL_LOG_ENABLE).toString());
+        }
+        if (loggerProperties.containsKey(LoggingConstants.SQL_LOG_SIMPLE)) {
+            props.getProps().setProperty(LoggingConstants.SQL_SIMPLE, loggerProperties.get(LoggingConstants.SQL_LOG_SIMPLE).toString());
+        }
+    }
+    
+    /**
+     * Refresh logger context with logging rule.
+     *
+     * @param loggingRuleConfiguration logging global rule configuration
+     */
+    public static void refreshLogger(final LoggingRuleConfiguration loggingRuleConfiguration) {
+        LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
+        configLoggers(loggingRuleConfiguration, loggerContext);
+        startRootLogger(loggerContext);
+    }
+    
+    private static void configLoggers(final LoggingRuleConfiguration loggingRuleConfiguration, final LoggerContext loggerContext) {
+        Collection<ShardingSphereLogger> loggers = loggingRuleConfiguration.getLoggers();
+        loggers.forEach(each -> {
+            Logger logger = loggerContext.getLogger(each.getLoggerName());
+            logger.setLevel(Level.valueOf(each.getLevel()));
+            logger.setAdditive(each.getAdditivity());
+            addAppender(logger, loggingRuleConfiguration, each.getAppenderName());
+        });
+    }
+    
+    @SneakyThrows({IncompatibleClassException.class, DynamicClassLoadingException.class})
+    @SuppressWarnings("unchecked")
+    private static void addAppender(final Logger logger, final LoggingRuleConfiguration loggingRuleConfiguration, final String appenderName) {
+        if (null == appenderName) {
+            return;
+        }
+        Optional<ShardingSphereAppender> shardingSphereAppenderOptional = loggingRuleConfiguration.getAppenders().stream().filter(each -> appenderName.equals(each.getAppenderName())).findFirst();
+        if (shardingSphereAppenderOptional.isPresent()) {
+            ShardingSphereAppender shardingSphereAppender = shardingSphereAppenderOptional.get();
+            Appender<ILoggingEvent> appender = (Appender<ILoggingEvent>) OptionHelper.instantiateByClassName(shardingSphereAppender.getAppenderClass(), Appender.class, logger.getLoggerContext());
+            appender.setContext(logger.getLoggerContext());
+            appender.setName(appenderName);
+            addEncoder(appender, shardingSphereAppender);
+            appender.start();
+            logger.detachAndStopAllAppenders();
+            logger.addAppender(appender);
+        }
+    }
+    
+    private static void addEncoder(final Appender<ILoggingEvent> appender, final ShardingSphereAppender shardingSphereAppender) {
+        if (appender instanceof OutputStreamAppender) {
+            OutputStreamAppender<ILoggingEvent> outputStreamAppender = (OutputStreamAppender<ILoggingEvent>) appender;
+            PatternLayoutEncoder patternLayoutEncoder = new PatternLayoutEncoder();
+            patternLayoutEncoder.setContext(appender.getContext());
+            patternLayoutEncoder.setPattern(shardingSphereAppender.getPattern());
+            outputStreamAppender.setEncoder(patternLayoutEncoder);
+            setFileOutput(outputStreamAppender, shardingSphereAppender);
+            patternLayoutEncoder.start();
+        }
+    }
+    
+    private static void setFileOutput(final OutputStreamAppender<ILoggingEvent> outputStreamAppender, final ShardingSphereAppender shardingSphereAppender) {
+        if (outputStreamAppender instanceof FileAppender) {
+            FileAppender<ILoggingEvent> fileAppender = (FileAppender<ILoggingEvent>) outputStreamAppender;
+            fileAppender.setFile(shardingSphereAppender.getFile());
+        }
+    }
+    
+    private static void startRootLogger(final LoggerContext loggerContext) {
+        Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
+        Iterator<Appender<ILoggingEvent>> appenderIterator = rootLogger.iteratorForAppenders();
+        while (appenderIterator.hasNext()) {
+            appenderIterator.next().start();
+        }
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlAppenderConfiguration.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlAppenderConfiguration.java
new file mode 100644
index 00000000000..cde2dce730b
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlAppenderConfiguration.java
@@ -0,0 +1,42 @@
+/*
+ * 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.shardingsphere.logging.yaml.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
+
+/**
+ * Appender configuration for YAML.
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public final class YamlAppenderConfiguration implements YamlConfiguration {
+    
+    private String appenderName;
+    
+    private String appenderClass;
+    
+    private String pattern;
+    
+    private String file;
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlAppendersConfigurationConverter.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlAppendersConfigurationConverter.java
new file mode 100644
index 00000000000..0918b101cbf
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlAppendersConfigurationConverter.java
@@ -0,0 +1,55 @@
+/*
+ * 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.shardingsphere.logging.yaml.config;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.yaml.swapper.YamlAppenderSwapper;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * Configuration converter for YAML appenders content.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class YamlAppendersConfigurationConverter {
+    
+    private static final YamlAppenderSwapper SWAPPER = new YamlAppenderSwapper();
+    
+    /**
+     * Convert to YAML appender configurations.
+     *
+     * @param appenders ShardingSphere appenders
+     * @return YAML appenders content
+     */
+    public static Collection<YamlAppenderConfiguration> convertYamlAppenderConfigurations(final Collection<ShardingSphereAppender> appenders) {
+        return appenders.stream().map(SWAPPER::swapToYamlConfiguration).collect(Collectors.toList());
+    }
+    
+    /**
+     * Convert to ShardingSphere appenders.
+     *
+     * @param appenders YAML appenders content
+     * @return ShardingSphere appenders
+     */
+    public static Collection<ShardingSphereAppender> convertShardingSphereAppender(final Collection<YamlAppenderConfiguration> appenders) {
+        return appenders.stream().map(SWAPPER::swapToObject).collect(Collectors.toList());
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggerConfiguration.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggerConfiguration.java
new file mode 100644
index 00000000000..0d5e4da0587
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggerConfiguration.java
@@ -0,0 +1,46 @@
+/*
+ * 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.shardingsphere.logging.yaml.config;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
+
+import java.util.Properties;
+
+/**
+ * Logger configuration for YAML.
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public final class YamlLoggerConfiguration implements YamlConfiguration {
+    
+    private String loggerName;
+    
+    private String level;
+    
+    private Boolean additivity;
+    
+    private String appenderName;
+    
+    private Properties props = new Properties();
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggersConfigurationConverter.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggersConfigurationConverter.java
new file mode 100644
index 00000000000..ea5fa554379
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggersConfigurationConverter.java
@@ -0,0 +1,55 @@
+/*
+ * 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.shardingsphere.logging.yaml.config;
+
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.yaml.swapper.YamlLoggerSwapper;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+/**
+ * Configuration converter for YAML loggers content.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class YamlLoggersConfigurationConverter {
+    
+    private static final YamlLoggerSwapper SWAPPER = new YamlLoggerSwapper();
+    
+    /**
+     * Convert to YAML logger configurations.
+     *
+     * @param loggers ShardingSphere loggers
+     * @return YAML loggers content
+     */
+    public static Collection<YamlLoggerConfiguration> convertYamlLoggerConfigurations(final Collection<ShardingSphereLogger> loggers) {
+        return loggers.stream().map(SWAPPER::swapToYamlConfiguration).collect(Collectors.toList());
+    }
+    
+    /**
+     * Convert to ShardingSphere loggers.
+     *
+     * @param loggers YAML loggers content
+     * @return ShardingSphere loggers
+     */
+    public static Collection<ShardingSphereLogger> convertShardingSphereLogger(final Collection<YamlLoggerConfiguration> loggers) {
+        return loggers.stream().map(SWAPPER::swapToObject).collect(Collectors.toList());
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
new file mode 100644
index 00000000000..b61ab8659da
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/config/YamlLoggingRuleConfiguration.java
@@ -0,0 +1,43 @@
+/*
+ * 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.shardingsphere.logging.yaml.config;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Logging rule configuration for YAML.
+ */
+@Getter
+@Setter
+public final class YamlLoggingRuleConfiguration implements YamlRuleConfiguration {
+    
+    private Collection<YamlLoggerConfiguration> loggers = new LinkedList<>();
+    
+    private Collection<YamlAppenderConfiguration> appenders = new LinkedList<>();
+    
+    @Override
+    public Class<LoggingRuleConfiguration> getRuleConfigurationType() {
+        return LoggingRuleConfiguration.class;
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlAppenderSwapper.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlAppenderSwapper.java
new file mode 100644
index 00000000000..bbb3698f8ef
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlAppenderSwapper.java
@@ -0,0 +1,48 @@
+/*
+ * 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.shardingsphere.logging.yaml.swapper;
+
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.yaml.config.YamlAppenderConfiguration;
+
+import java.util.Objects;
+
+/**
+ * YAML appender swapper.
+ */
+public final class YamlAppenderSwapper implements YamlConfigurationSwapper<YamlAppenderConfiguration, ShardingSphereAppender> {
+    
+    @Override
+    public YamlAppenderConfiguration swapToYamlConfiguration(final ShardingSphereAppender data) {
+        if (Objects.isNull(data)) {
+            return null;
+        }
+        return new YamlAppenderConfiguration(data.getAppenderName(), data.getAppenderClass(), data.getPattern(), data.getFile());
+    }
+    
+    @Override
+    public ShardingSphereAppender swapToObject(final YamlAppenderConfiguration yamlConfig) {
+        if (Objects.isNull(yamlConfig)) {
+            return null;
+        }
+        ShardingSphereAppender result = new ShardingSphereAppender(yamlConfig.getAppenderName(), yamlConfig.getAppenderClass(), yamlConfig.getPattern());
+        result.setFile(yamlConfig.getFile());
+        return result;
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggerSwapper.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggerSwapper.java
new file mode 100644
index 00000000000..7cb4ff5bed3
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggerSwapper.java
@@ -0,0 +1,48 @@
+/*
+ * 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.shardingsphere.logging.yaml.swapper;
+
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.yaml.config.YamlLoggerConfiguration;
+import org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
+
+import java.util.Objects;
+
+/**
+ * YAML logger swapper.
+ */
+public final class YamlLoggerSwapper implements YamlConfigurationSwapper<YamlLoggerConfiguration, ShardingSphereLogger> {
+    
+    @Override
+    public YamlLoggerConfiguration swapToYamlConfiguration(final ShardingSphereLogger data) {
+        if (Objects.isNull(data)) {
+            return null;
+        }
+        return new YamlLoggerConfiguration(data.getLoggerName(), data.getLevel(), data.getAdditivity(), data.getAppenderName(), data.getProps());
+    }
+    
+    @Override
+    public ShardingSphereLogger swapToObject(final YamlLoggerConfiguration yamlConfig) {
+        if (Objects.isNull(yamlConfig)) {
+            return null;
+        }
+        ShardingSphereLogger result = new ShardingSphereLogger(yamlConfig.getLoggerName(), yamlConfig.getLevel(), yamlConfig.getAdditivity(), yamlConfig.getAppenderName());
+        result.setProps(yamlConfig.getProps());
+        return result;
+    }
+}
diff --git a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapper.java b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapper.java
new file mode 100644
index 00000000000..757eec35859
--- /dev/null
+++ b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapper.java
@@ -0,0 +1,65 @@
+/*
+ * 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.shardingsphere.logging.yaml.swapper;
+
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.constant.LoggingOrder;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
+import org.apache.shardingsphere.logging.yaml.config.YamlAppendersConfigurationConverter;
+import org.apache.shardingsphere.logging.yaml.config.YamlLoggersConfigurationConverter;
+import org.apache.shardingsphere.logging.yaml.config.YamlLoggingRuleConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper;
+
+/**
+ * YAML logging rule configuration swapper.
+ */
+public final class YamlLoggingRuleConfigurationSwapper implements YamlRuleConfigurationSwapper<YamlLoggingRuleConfiguration, LoggingRuleConfiguration> {
+    
+    @Override
+    public YamlLoggingRuleConfiguration swapToYamlConfiguration(final LoggingRuleConfiguration data) {
+        YamlLoggingRuleConfiguration result = new YamlLoggingRuleConfiguration();
+        result.setLoggers(YamlLoggersConfigurationConverter.convertYamlLoggerConfigurations(data.getLoggers()));
+        result.setAppenders(YamlAppendersConfigurationConverter.convertYamlAppenderConfigurations(data.getAppenders()));
+        return result;
+    }
+    
+    @Override
+    public LoggingRuleConfiguration swapToObject(final YamlLoggingRuleConfiguration yamlConfig) {
+        LoggingRuleConfiguration result = new LoggingRuleConfiguration(YamlLoggersConfigurationConverter.convertShardingSphereLogger(yamlConfig.getLoggers()),
+                YamlAppendersConfigurationConverter.convertShardingSphereAppender(yamlConfig.getAppenders()));
+        if (null == result.getLoggers()) {
+            result = new DefaultLoggingRuleConfigurationBuilder().build();
+        }
+        return result;
+    }
+    
+    @Override
+    public Class<LoggingRuleConfiguration> getTypeClass() {
+        return LoggingRuleConfiguration.class;
+    }
+    
+    @Override
+    public String getRuleTagName() {
+        return "LOGGING";
+    }
+    
+    @Override
+    public int getOrder() {
+        return LoggingOrder.ORDER;
+    }
+}
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
new file mode 100644
index 00000000000..a48557a0a7b
--- /dev/null
+++ b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder
diff --git a/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder
new file mode 100644
index 00000000000..7872d269fd1
--- /dev/null
+++ b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.logging.rule.builder.LoggingRuleBuilder
diff --git a/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
new file mode 100644
index 00000000000..8e96a49b04b
--- /dev/null
+++ b/kernel/logging/core/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.logging.yaml.swapper.YamlLoggingRuleConfigurationSwapper
diff --git a/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/rule/LoggingRuleTest.java b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/rule/LoggingRuleTest.java
new file mode 100644
index 00000000000..e7d20eab195
--- /dev/null
+++ b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/rule/LoggingRuleTest.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.shardingsphere.logging.rule;
+
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+public final class LoggingRuleTest {
+    
+    private LoggingRule loggingRule;
+    
+    @Before
+    public void setup() {
+        loggingRule = new LoggingRule(new LoggingRuleConfiguration(Collections.singleton(new ShardingSphereLogger("ROOT", "INFO", true, "console")),
+                Collections.singleton(new ShardingSphereAppender("console", "ch.qos.logback.core.ConsoleAppender", "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n"))));
+    }
+    
+    @Test
+    public void assertGetType() {
+        assertThat(loggingRule.getType(), is(LoggingRule.class.getSimpleName()));
+    }
+    
+    @Test
+    public void assertFields() {
+        assertThat(loggingRule.getConfiguration().getLoggers().size(), is(1));
+        assertThat(loggingRule.getConfiguration().getAppenders().size(), is(1));
+    }
+}
diff --git a/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/rule/builder/DefaultLoggingRuleConfigurationBuilderTest.java b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/rule/builder/DefaultLoggingRuleConfigurationBuilderTest.java
new file mode 100644
index 00000000000..bc23f65d0cf
--- /dev/null
+++ b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/rule/builder/DefaultLoggingRuleConfigurationBuilderTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.shardingsphere.logging.rule.builder;
+
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public final class DefaultLoggingRuleConfigurationBuilderTest {
+    
+    @Test
+    public void assertBuild() {
+        LoggingRuleConfiguration actual = new DefaultLoggingRuleConfigurationBuilder().build();
+        assertThat(actual.getLoggers().size(), is(4));
+        assertThat(actual.getAppenders().size(), is(1));
+    }
+}
diff --git a/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/YamlLoggingRuleConfigurationSwapperTest.java b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/YamlLoggingRuleConfigurationSwapperTest.java
new file mode 100644
index 00000000000..c8ee3dda3ce
--- /dev/null
+++ b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/YamlLoggingRuleConfigurationSwapperTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.shardingsphere.logging.yaml;
+
+import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.logger.ShardingSphereAppender;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.yaml.config.YamlLoggingRuleConfiguration;
+import org.apache.shardingsphere.logging.yaml.swapper.YamlAppenderSwapper;
+import org.apache.shardingsphere.logging.yaml.swapper.YamlLoggerSwapper;
+import org.apache.shardingsphere.logging.yaml.swapper.YamlLoggingRuleConfigurationSwapper;
+import org.junit.Test;
+
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public final class YamlLoggingRuleConfigurationSwapperTest {
+    
+    private final YamlLoggingRuleConfigurationSwapper swapper = new YamlLoggingRuleConfigurationSwapper();
+    
+    private final YamlLoggerSwapper loggerSwapper = new YamlLoggerSwapper();
+    
+    private final YamlAppenderSwapper appenderSwapper = new YamlAppenderSwapper();
+    
+    @Test
+    public void swapToYamlConfiguration() {
+        YamlLoggingRuleConfiguration yamlLoggingRuleConfiguration = swapper.swapToYamlConfiguration(createLoggingRuleConfiguration());
+        assertThat(yamlLoggingRuleConfiguration.getLoggers().size(), is(1));
+        assertThat(yamlLoggingRuleConfiguration.getAppenders().size(), is(1));
+    }
+    
+    private LoggingRuleConfiguration createLoggingRuleConfiguration() {
+        return new LoggingRuleConfiguration(Collections.singleton(new ShardingSphereLogger("ROOT", "INFO", true, "console")),
+                Collections.singleton(new ShardingSphereAppender("console", "ch.qos.logback.core.ConsoleAppender", "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n")));
+    }
+    
+    @Test
+    public void swapToObject() {
+        LoggingRuleConfiguration loggingRuleConfiguration = swapper.swapToObject(createYamlLoggingRuleConfiguration());
+        assertThat(loggingRuleConfiguration.getLoggers().size(), is(1));
+        assertThat(loggingRuleConfiguration.getAppenders().size(), is(1));
+    }
+    
+    private YamlLoggingRuleConfiguration createYamlLoggingRuleConfiguration() {
+        YamlLoggingRuleConfiguration result = new YamlLoggingRuleConfiguration();
+        result.setLoggers(Collections.singleton(loggerSwapper.swapToYamlConfiguration(new ShardingSphereLogger("ROOT", "INFO", true, "console"))));
+        result.setAppenders(Collections.singleton(appenderSwapper.swapToYamlConfiguration(
+                new ShardingSphereAppender("console", "ch.qos.logback.core.ConsoleAppender", "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n"))));
+        return result;
+    }
+}
diff --git a/kernel/logging/core/src/test/resources/logback.xml b/kernel/logging/core/src/test/resources/logback.xml
new file mode 100644
index 00000000000..98875960915
--- /dev/null
+++ b/kernel/logging/core/src/test/resources/logback.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+
+<configuration>
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <logger name="org.apache.shardingsphere" level="info" additivity="false">
+        <appender-ref ref="console" />
+    </logger>
+
+    <logger name="com.zaxxer.hikari" level="error" />
+
+    <logger name="com.atomikos" level="error" />
+
+    <logger name="io.netty" level="error" />
+
+    <root>
+        <level value="info" />
+        <appender-ref ref="console" />
+    </root>
+</configuration>
diff --git a/kernel/pom.xml b/kernel/logging/pom.xml
similarity index 74%
copy from kernel/pom.xml
copy to kernel/logging/pom.xml
index 75c3a4101dd..5bf732a5a96 100644
--- a/kernel/pom.xml
+++ b/kernel/logging/pom.xml
@@ -21,23 +21,15 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere</artifactId>
+        <artifactId>shardingsphere-kernel</artifactId>
         <version>5.3.2-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-kernel</artifactId>
+    <artifactId>shardingsphere-logging</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>parser</module>
-        <module>single</module>
-        <module>authority</module>
-        <module>transaction</module>
-        <module>time-service</module>
-        <module>schedule</module>
-        <module>data-pipeline</module>
-        <module>sql-federation</module>
-        <module>sql-translator</module>
-        <module>traffic</module>
+        <module>api</module>
+        <module>core</module>
     </modules>
 </project>
diff --git a/kernel/pom.xml b/kernel/pom.xml
index 75c3a4101dd..101c65993cb 100644
--- a/kernel/pom.xml
+++ b/kernel/pom.xml
@@ -39,5 +39,6 @@
         <module>sql-federation</module>
         <module>sql-translator</module>
         <module>traffic</module>
+        <module>logging</module>
     </modules>
 </project>
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
index 924f757e171..107908806b1 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/MetaDataContexts.java
@@ -68,6 +68,7 @@ public final class MetaDataContexts implements AutoCloseable {
         Optional<ShardingSphereData> loadedShardingSphereData = Optional.ofNullable(persistService.getShardingSphereDataPersistService())
                 .flatMap(shardingSphereDataPersistService -> shardingSphereDataPersistService.load(metaData));
         loadedShardingSphereData.ifPresent(optional -> useLoadedToReplaceInit(result, optional));
+        // TODO skip this while instance type is JDBC
         refreshRootLogger(metaData.getProps().getProps());
         return result;
     }
diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java
index 273870b2a36..890efdf71e9 100644
--- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java
+++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ConfigurationChangedSubscriberTest.java
@@ -37,6 +37,7 @@ import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule;
 import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter;
 import org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder;
@@ -154,10 +155,11 @@ public final class ConfigurationChangedSubscriberTest {
         GlobalRuleConfigurationsChangedEvent event = new GlobalRuleConfigurationsChangedEvent(getChangedGlobalRuleConfigurations());
         subscriber.renew(event);
         assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData(), not(globalRuleMetaData));
-        assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getRules().size(), is(3));
+        assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getRules().size(), is(4));
         assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getRules().stream().filter(each -> each instanceof AuthorityRule).count(), is(1L));
         assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getRules().stream().filter(each -> each instanceof TransactionRule).count(), is(1L));
         assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getRules().stream().filter(each -> each instanceof SQLTranslatorRule).count(), is(1L));
+        assertThat(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getRules().stream().filter(each -> each instanceof LoggingRule).count(), is(1L));
     }
     
     private Collection<RuleConfiguration> getChangedGlobalRuleConfigurations() {
diff --git a/proxy/backend/pom.xml b/proxy/backend/pom.xml
index f9cc7d9edf5..c68dacbe35a 100644
--- a/proxy/backend/pom.xml
+++ b/proxy/backend/pom.xml
@@ -193,6 +193,11 @@
             <artifactId>shardingsphere-sql-federation-executor-original</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-logging-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
index 3247e2fd41b..b3ff26880c2 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
@@ -100,6 +100,9 @@ public final class ProxyConfigurationLoader {
         if (null != serverConfiguration.getCdc()) {
             serverConfiguration.getRules().add(serverConfiguration.getCdc());
         }
+        if (null != serverConfiguration.getLogging()) {
+            serverConfiguration.getRules().add(serverConfiguration.getLogging());
+        }
         return serverConfiguration;
     }
     
diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
index 3afc04bf27f..de78031cc40 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/config/yaml/YamlProxyServerConfiguration.java
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.data.pipeline.cdc.yaml.config.YamlCDCRuleConfig
 import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration;
+import org.apache.shardingsphere.logging.yaml.config.YamlLoggingRuleConfiguration;
 import org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration;
 import org.apache.shardingsphere.sqltranslator.yaml.config.YamlSQLTranslatorRuleConfiguration;
 import org.apache.shardingsphere.traffic.yaml.config.YamlTrafficRuleConfiguration;
@@ -54,6 +55,8 @@ public final class YamlProxyServerConfiguration implements YamlConfiguration {
     
     private YamlCDCRuleConfiguration cdc;
     
+    private YamlLoggingRuleConfiguration logging;
+    
     private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
     
     private Properties props = new Properties();
diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
index c1875250420..c75e5d3dd81 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
@@ -21,6 +21,9 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDist
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.logging.constant.LoggingConstants;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.utils.LoggingUtils;
 import org.apache.shardingsphere.proxy.backend.exception.UnsupportedVariableException;
 import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
 import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.executor.ConnectionSessionRequiredQueryableRALExecutor;
@@ -31,6 +34,8 @@ import org.apache.shardingsphere.transaction.api.TransactionType;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Optional;
+import java.util.Properties;
 
 /**
  * Show dist variable executor.
@@ -53,11 +58,31 @@ public final class ShowDistVariableExecutor implements ConnectionSessionRequired
                 : Collections.singletonList(new LocalDataQueryResultRow(variableName.toLowerCase(), getSpecialValue(connectionSession, variableName)));
     }
     
-    private boolean isConfigurationKey(final String key) {
-        return ConfigurationPropertyKey.getKeyNames().contains(key);
+    private boolean isConfigurationKey(final String variableName) {
+        return ConfigurationPropertyKey.getKeyNames().contains(variableName);
     }
     
     private String getConfigurationValue(final ShardingSphereMetaData metaData, final String variableName) {
+        if (LoggingConstants.SQL_SHOW_VARIABLE_NAME.equalsIgnoreCase(variableName) || LoggingConstants.SQL_SIMPLE_VARIABLE_NAME.equalsIgnoreCase(variableName)) {
+            return getLoggingPropsValue(metaData, variableName);
+        }
+        return metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(variableName)).toString();
+    }
+    
+    private String getLoggingPropsValue(final ShardingSphereMetaData metaData, final String variableName) {
+        Optional<ShardingSphereLogger> sqlLogger = LoggingUtils.getSQLLogger(metaData.getGlobalRuleMetaData());
+        if (sqlLogger.isPresent()) {
+            Properties props = sqlLogger.get().getProps();
+            switch (variableName) {
+                case LoggingConstants.SQL_SHOW_VARIABLE_NAME:
+                    return props.getOrDefault(LoggingConstants.SQL_LOG_ENABLE,
+                            metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(variableName)).toString()).toString();
+                case LoggingConstants.SQL_SIMPLE_VARIABLE_NAME:
+                    return props.getOrDefault(LoggingConstants.SQL_LOG_SIMPLE,
+                            metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(variableName)).toString()).toString();
+                default:
+            }
+        }
         return metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(variableName)).toString();
     }
     
diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
index cda0281e7a0..b611707cec7 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
@@ -21,6 +21,9 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDist
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.logging.constant.LoggingConstants;
+import org.apache.shardingsphere.logging.logger.ShardingSphereLogger;
+import org.apache.shardingsphere.logging.utils.LoggingUtils;
 import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
 import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.executor.ConnectionSessionRequiredQueryableRALExecutor;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
@@ -28,6 +31,8 @@ import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Optional;
+import java.util.Properties;
 import java.util.stream.Collectors;
 
 /**
@@ -42,15 +47,30 @@ public final class ShowDistVariablesExecutor implements ConnectionSessionRequire
     
     @Override
     public Collection<LocalDataQueryResultRow> getRows(final ShardingSphereMetaData metaData, final ConnectionSession connectionSession, final ShowDistVariablesStatement sqlStatement) {
-        Collection<LocalDataQueryResultRow> result = ConfigurationPropertyKey.getKeyNames().stream()
+        Collection<LocalDataQueryResultRow> result = ConfigurationPropertyKey.getKeyNames().stream().filter(each -> !"sql_show".equalsIgnoreCase(each) && !"sql_simple".equalsIgnoreCase(each))
                 .map(each -> new LocalDataQueryResultRow(each.toLowerCase(), metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(each)).toString())).collect(Collectors.toList());
         result.add(new LocalDataQueryResultRow(
                 VariableEnum.AGENT_PLUGINS_ENABLED.name().toLowerCase(), SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString())));
         result.add(new LocalDataQueryResultRow(VariableEnum.CACHED_CONNECTIONS.name().toLowerCase(), connectionSession.getBackendConnection().getConnectionSize()));
         result.add(new LocalDataQueryResultRow(VariableEnum.TRANSACTION_TYPE.name().toLowerCase(), connectionSession.getTransactionStatus().getTransactionType().name()));
+        addLoggingPropsRows(metaData, result);
         return result;
     }
     
+    private void addLoggingPropsRows(final ShardingSphereMetaData metaData, final Collection<LocalDataQueryResultRow> result) {
+        Optional<ShardingSphereLogger> sqlLogger = LoggingUtils.getSQLLogger(metaData.getGlobalRuleMetaData());
+        if (sqlLogger.isPresent()) {
+            Properties sqlLoggerProps = sqlLogger.get().getProps();
+            result.add(new LocalDataQueryResultRow(LoggingConstants.SQL_SHOW_VARIABLE_NAME, sqlLoggerProps.getOrDefault(LoggingConstants.SQL_LOG_ENABLE, Boolean.FALSE).toString()));
+            result.add(new LocalDataQueryResultRow(LoggingConstants.SQL_SIMPLE_VARIABLE_NAME, sqlLoggerProps.getOrDefault(LoggingConstants.SQL_LOG_SIMPLE, Boolean.FALSE).toString()));
+        } else {
+            result.add(new LocalDataQueryResultRow(LoggingConstants.SQL_SHOW_VARIABLE_NAME,
+                    metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(LoggingConstants.SQL_SHOW_VARIABLE_NAME.toUpperCase())).toString()));
+            result.add(new LocalDataQueryResultRow(LoggingConstants.SQL_SIMPLE_VARIABLE_NAME,
+                    metaData.getProps().getValue(ConfigurationPropertyKey.valueOf(LoggingConstants.SQL_SIMPLE_VARIABLE_NAME.toUpperCase())).toString()));
+        }
+    }
+    
     @Override
     public String getType() {
         return ShowDistVariablesStatement.class.getName();
diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableHandler.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableHandler.java
index 8a8ebeff965..d727ee70621 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableHandler.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableHandler.java
@@ -22,6 +22,8 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.updatable.SetDistV
 import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.util.props.TypedPropertyValue;
 import org.apache.shardingsphere.infra.util.props.exception.TypedPropertyValueException;
+import org.apache.shardingsphere.logging.constant.LoggingConstants;
+import org.apache.shardingsphere.logging.utils.LoggingUtils;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -66,6 +68,8 @@ public final class SetDistVariableHandler extends UpdatableRALBackendHandler<Set
         props.putAll(metaDataContexts.getMetaData().getProps().getProps());
         props.put(propertyKey.getKey(), getValue(propertyKey, value));
         contextManager.getInstanceContext().getModeContextManager().alterProperties(props);
+        syncSQLShowToLoggingRule(propertyKey, metaDataContexts, value);
+        syncSQLSimpleToLoggingRule(propertyKey, metaDataContexts, value);
     }
     
     private Object getValue(final ConfigurationPropertyKey propertyKey, final String value) {
@@ -77,6 +81,24 @@ public final class SetDistVariableHandler extends UpdatableRALBackendHandler<Set
         }
     }
     
+    private void syncSQLShowToLoggingRule(final ConfigurationPropertyKey propertyKey, final MetaDataContexts metaDataContexts, final String value) {
+        if (LoggingConstants.SQL_SHOW.equalsIgnoreCase(propertyKey.getKey())) {
+            LoggingUtils.getSQLLogger(metaDataContexts.getMetaData().getGlobalRuleMetaData()).ifPresent(option -> {
+                option.getProps().setProperty(LoggingConstants.SQL_LOG_ENABLE, value);
+                metaDataContexts.getPersistService().getGlobalRuleService().persist(metaDataContexts.getMetaData().getGlobalRuleMetaData().getConfigurations());
+            });
+        }
+    }
+    
+    private void syncSQLSimpleToLoggingRule(final ConfigurationPropertyKey propertyKey, final MetaDataContexts metaDataContexts, final String value) {
+        if (LoggingConstants.SQL_SIMPLE.equalsIgnoreCase(propertyKey.getKey())) {
+            LoggingUtils.getSQLLogger(metaDataContexts.getMetaData().getGlobalRuleMetaData()).ifPresent(option -> {
+                option.getProps().setProperty(LoggingConstants.SQL_LOG_SIMPLE, value);
+                metaDataContexts.getPersistService().getGlobalRuleService().persist(metaDataContexts.getMetaData().getGlobalRuleMetaData().getConfigurations());
+            });
+        }
+    }
+    
     private void handleVariables() {
         VariableEnum variable = VariableEnum.getValueOf(getSqlStatement().getName());
         switch (variable) {
diff --git a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java
index 89a899b619a..56e5e4f8aa5 100644
--- a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java
+++ b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java
@@ -21,6 +21,9 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDist
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.proxy.backend.exception.UnsupportedVariableException;
 import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
@@ -32,6 +35,7 @@ import org.apache.shardingsphere.transaction.api.TransactionType;
 import org.junit.Test;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -92,6 +96,7 @@ public final class ShowDistVariableExecutorTest extends ProxyContextRestorer {
     @Test
     public void assertShowPropsVariable() {
         when(metaData.getProps()).thenReturn(new ConfigurationProperties(PropertiesBuilder.build(new Property("sql-show", Boolean.TRUE.toString()))));
+        when(metaData.getGlobalRuleMetaData()).thenReturn(new ShardingSphereRuleMetaData(Collections.singleton(new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build()))));
         ShowDistVariableExecutor executor = new ShowDistVariableExecutor();
         Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, connectionSession, new ShowDistVariableStatement("SQL_SHOW"));
         assertThat(actual.size(), is(1));
diff --git a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
index e84e96d946f..d2ad1a462db 100644
--- a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
+++ b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutorTest.java
@@ -21,6 +21,9 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowDist
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
 import org.apache.shardingsphere.test.util.PropertiesBuilder;
@@ -29,6 +32,7 @@ import org.junit.Test;
 
 import java.sql.SQLException;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -56,6 +60,7 @@ public final class ShowDistVariablesExecutorTest extends ProxyContextRestorer {
     @Test
     public void assertExecute() throws SQLException {
         when(metaData.getProps()).thenReturn(new ConfigurationProperties(PropertiesBuilder.build(new Property("system_log_level", "INFO"))));
+        when(metaData.getGlobalRuleMetaData()).thenReturn(new ShardingSphereRuleMetaData(Collections.singleton(new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build()))));
         ShowDistVariablesExecutor executor = new ShowDistVariablesExecutor();
         Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, connectionSession, mock(ShowDistVariablesStatement.class));
         assertThat(actual.size(), is(21));
diff --git a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/LogbackConfiguration.java b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/LogbackConfiguration.java
index 6cc0defc633..cf38e53277d 100644
--- a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/LogbackConfiguration.java
+++ b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/config/LogbackConfiguration.java
@@ -30,7 +30,7 @@ public class LogbackConfiguration extends BasicConfigurator {
     
     public static final String DEFAULT_PATTERN = "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n";
     
-    public static final String SHARDINGSPHERE_LOGGER_NAME = "org.apache.shardingsphere";
+    public static final String SHARDINGSPHERE_SQL_LOGGER_NAME = "ShardingSphere-SQL";
     
     public static final String HIKARI_LOGGER_NAME = "com.zaxxer.hikari";
     
@@ -44,10 +44,6 @@ public class LogbackConfiguration extends BasicConfigurator {
         Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
         rootLogger.setLevel(Level.INFO);
         rootLogger.addAppender(consoleAppender);
-        Logger logger = loggerContext.getLogger(SHARDINGSPHERE_LOGGER_NAME);
-        logger.setLevel(Level.INFO);
-        logger.setAdditive(false);
-        logger.addAppender(consoleAppender);
         initBasicLogger(loggerContext);
     }
     
@@ -78,6 +74,7 @@ public class LogbackConfiguration extends BasicConfigurator {
     }
     
     private void initBasicLogger(final LoggerContext loggerContext) {
+        loggerContext.getLogger(SHARDINGSPHERE_SQL_LOGGER_NAME).setLevel(Level.INFO);
         loggerContext.getLogger(HIKARI_LOGGER_NAME).setLevel(Level.ERROR);
         loggerContext.getLogger(ATOMIKOS_LOGGER_NAME).setLevel(Level.ERROR);
         loggerContext.getLogger(NETTY_LOGGER_NAME).setLevel(Level.ERROR);
diff --git a/proxy/bootstrap/src/main/resources/conf/server.yaml b/proxy/bootstrap/src/main/resources/conf/server.yaml
index d18fd96d71f..44ea4e14614 100644
--- a/proxy/bootstrap/src/main/resources/conf/server.yaml
+++ b/proxy/bootstrap/src/main/resources/conf/server.yaml
@@ -59,12 +59,21 @@
 #  enabled: false
 #  port: 33071
 #
+#logging:
+#  loggers:
+#  - loggerName: ShardingSphere-SQL
+#    additivity: true
+#    level: INFO
+#    props:
+#      enable: false
+#
 #props:
 #  system-log-level: INFO
 #  max-connections-size-per-query: 1
 #  kernel-executor-size: 16  # Infinite by default.
 #  proxy-frontend-flush-threshold: 128  # The default value is 128.
 #  proxy-hint-enabled: false
+#  # sql-show is the same as props in logger ShardingSphere-SQL, and its priority is lower than logging rule
 #  sql-show: false
 #  check-table-metadata-enabled: false
 #    # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
diff --git a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/LogbackTest.java b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/LogbackTest.java
index a42edbe6319..7afeacb1a73 100644
--- a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/LogbackTest.java
+++ b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/config/LogbackTest.java
@@ -49,7 +49,6 @@ public final class LogbackTest {
         assertTrue(encoder.getLayout() instanceof PatternLayout);
         PatternLayout layout = (PatternLayout) encoder.getLayout();
         assertThat(layout.getPattern(), is(DEFAULT_PATTERN));
-        assertThat(loggerContext.getLogger("org.apache.shardingsphere").getLevel(), is(Level.INFO));
         assertThat(loggerContext.getLogger("com.zaxxer.hikari").getLevel(), is(Level.ERROR));
         assertThat(loggerContext.getLogger("com.atomikos").getLevel(), is(Level.ERROR));
         assertThat(loggerContext.getLogger("io.netty").getLevel(), is(Level.ERROR));
diff --git a/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutorTest.java b/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutorTest.java
index bba55450164..f22fe69eed2 100644
--- a/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutorTest.java
+++ b/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLComQueryPacketExecutorTest.java
@@ -27,6 +27,8 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.parser.rule.SQLParserRule;
 import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -118,7 +120,8 @@ public final class MySQLComQueryPacketExecutorTest {
                     .thenReturn(Collections.singletonMap("ds_0", new MySQLDatabaseType()));
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase("db_name").getProtocolType()).thenReturn(new MySQLDatabaseType());
             ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(
-                    Arrays.asList(new SQLParserRule(new DefaultSQLParserRuleConfigurationBuilder().build()), new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build())));
+                    Arrays.asList(new SQLParserRule(new DefaultSQLParserRuleConfigurationBuilder().build()), new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()),
+                            new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build())));
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE)).thenReturn(1);
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)).thenReturn(false);
diff --git a/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java b/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java
index cf0d2d84aea..42c9075140f 100644
--- a/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java
+++ b/proxy/frontend/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java
@@ -23,6 +23,8 @@ import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
 import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption;
 import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.parser.rule.SQLParserRule;
 import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
 import org.apache.shardingsphere.proxy.backend.communication.BackendConnection;
@@ -98,7 +100,8 @@ public final class MySQLMultiStatementsHandlerTest {
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getDatabase("db").getRuleMetaData())
                     .thenReturn(new ShardingSphereRuleMetaData(Collections.emptyList()));
             ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(
-                    Arrays.asList(new SQLParserRule(new DefaultSQLParserRuleConfigurationBuilder().build()), new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build())));
+                    Arrays.asList(new SQLParserRule(new DefaultSQLParserRuleConfigurationBuilder().build()), new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()),
+                            new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build())));
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE)).thenReturn(1);
             when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)).thenReturn(false);
diff --git a/proxy/frontend/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java b/proxy/frontend/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java
index 8d195689f5b..bd4edf136ae 100644
--- a/proxy/frontend/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java
+++ b/proxy/frontend/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/query/extended/bind/OpenGaussComBatchBindExecutorTest.java
@@ -33,6 +33,8 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.Statemen
 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.backend.communication.BackendConnection;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.JDBCBackendStatement;
@@ -51,6 +53,7 @@ import org.junit.Test;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 
@@ -81,7 +84,8 @@ public final class OpenGaussComBatchBindExecutorTest extends ProxyContextRestore
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE)).thenReturn(0);
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY)).thenReturn(1);
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)).thenReturn(false);
-        ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build())));
+        ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()),
+                new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build())));
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
         ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
         when(database.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singletonList("ds_0"));
diff --git a/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java b/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
index f4899a79e40..7947885ead5 100644
--- a/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
+++ b/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutorTest.java
@@ -38,6 +38,8 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.Statemen
 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.backend.communication.BackendConnection;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.JDBCBackendStatement;
@@ -56,6 +58,7 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
@@ -92,8 +95,9 @@ public final class PostgreSQLAggregatedBatchedStatementsCommandExecutorTest exte
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.KERNEL_EXECUTOR_SIZE)).thenReturn(0);
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY)).thenReturn(1);
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.SQL_SHOW)).thenReturn(false);
-        when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData())
-                .thenReturn(new ShardingSphereRuleMetaData(Collections.singleton(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()))));
+        ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()),
+                new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build())));
+        when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
         ConnectionSession connectionSession = mock(ConnectionSession.class);
         when(connectionSession.getDatabaseName()).thenReturn("db");
         when(connectionSession.getConnectionContext()).thenReturn(new ConnectionContext());
diff --git a/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java b/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
index cfdf05c7a74..2f1bbea7f3a 100644
--- a/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
+++ b/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
@@ -30,6 +30,8 @@ import org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMod
 import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.StatementOption;
 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.backend.communication.BackendConnection;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.JDBCBackendStatement;
@@ -97,7 +99,8 @@ public final class PostgreSQLBatchedStatementsExecutorTest extends ProxyContextR
         when(database.getResourceMetaData().getAllInstanceDataSourceNames()).thenReturn(Collections.singletonList("ds_0"));
         when(database.getRuleMetaData()).thenReturn(new ShardingSphereRuleMetaData(Collections.emptyList()));
         when(contextManager.getMetaDataContexts().getMetaData().getDatabase("db")).thenReturn(database);
-        ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Collections.singleton(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build())));
+        ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()),
+                new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build())));
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
     }
     
diff --git a/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java b/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
index 12ac573087d..f7a2ca16b83 100644
--- a/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
+++ b/proxy/frontend/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/describe/PostgreSQLComDescribeExecutorTest.java
@@ -39,6 +39,8 @@ import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.
 import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
 import org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine;
 import org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
+import org.apache.shardingsphere.logging.rule.LoggingRule;
+import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.proxy.backend.communication.BackendConnection;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -115,8 +117,9 @@ public final class PostgreSQLComDescribeExecutorTest extends ProxyContextRestore
         when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.SQL_SHOW)).thenReturn(false);
         when(connectionSession.getDatabaseName()).thenReturn(DATABASE_NAME);
         when(connectionSession.getServerPreparedStatementRegistry()).thenReturn(new ServerPreparedStatementRegistry());
-        when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData())
-                .thenReturn(new ShardingSphereRuleMetaData(Collections.singleton(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()))));
+        ShardingSphereRuleMetaData globalRuleMetaData = new ShardingSphereRuleMetaData(Arrays.asList(new SQLTranslatorRule(new DefaultSQLTranslatorRuleConfigurationBuilder().build()),
+                new LoggingRule(new DefaultLoggingRuleConfigurationBuilder().build())));
+        when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
         when(contextManager.getMetaDataContexts().getMetaData().getDatabases()).thenReturn(Collections.singletonMap(DATABASE_NAME, mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS)));
         prepareTableMetaData();
     }