This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 136cea69b0d feat: update SQLLogger topic name and related
configs/tests/docs (#37029)
136cea69b0d is described below
commit 136cea69b0d00b5e582d22f76a53c2e1c1ce1da4
Author: Harsh Mehta <[email protected]>
AuthorDate: Sun Nov 9 12:17:50 2025 +0530
feat: update SQLLogger topic name and related configs/tests/docs (#37029)
* feat: update SQLLogger topic name and related configs/tests/docs
* chore: trigger GitHub Action
---
...h_Availability_with_Apache_ShardingSphere.en.md | 36 +++++++++++-----------
.../content/user-manual/common-config/props.cn.md | 2 +-
.../content/user-manual/common-config/props.en.md | 2 +-
.../shardingsphere-proxy/yaml-config/props.cn.md | 2 +-
.../shardingsphere-proxy/yaml-config/props.en.md | 2 +-
.../infra/executor/sql/log/SQLLogger.java | 2 +-
.../infra/executor/sql/log/SQLLoggerTest.java | 2 +-
infra/executor/src/test/resources/logback-test.xml | 2 +-
.../bootstrap/src/main/resources/conf/global.yaml | 2 +-
9 files changed, 26 insertions(+), 26 deletions(-)
diff --git
a/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md
b/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md
index 2dae7f6591b..cf636d5a183 100644
---
a/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md
+++
b/docs/blog/content/material/2022_03_16_Create_a_Distributed_Database_with_High_Availability_with_Apache_ShardingSphere.en.md
@@ -147,9 +147,9 @@ Query OK, 1 row affected (0.10 sec)
View the ShardingSphere-Proxy log and see if the route node is the primary
database `ds_0`.
```
-[INFO ] 2022-02-28 15:28:21.495 [ShardingSphere-Command-2] ShardingSphere-SQL
- Logic SQL: INSERT INTO t_user(id, mobile, idcard) value (10000,
'13718687777', '141121xxxxx')
-[INFO ] 2022-02-28 15:28:21.495 [ShardingSphere-Command-2] ShardingSphere-SQL
- SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty,
onDuplicateKeyColumns=Optional.empty)
-[INFO ] 2022-02-28 15:28:21.495 [ShardingSphere-Command-2] ShardingSphere-SQL
- Actual SQL: ds_0 ::: INSERT INTO t_user(id, mobile, idcard) value (10000,
'13718687777', '141121xxxxx')
+[INFO ] 2022-02-28 15:28:21.495 [ShardingSphere-Command-2]
org.apache.shardingsphere.sql - Logic SQL: INSERT INTO t_user(id, mobile,
idcard) value (10000, '13718687777', '141121xxxxx')
+[INFO ] 2022-02-28 15:28:21.495 [ShardingSphere-Command-2]
org.apache.shardingsphere.sql - SQLStatement:
MySQLInsertStatement(setAssignment=Optional.empty,
onDuplicateKeyColumns=Optional.empty)
+[INFO ] 2022-02-28 15:28:21.495 [ShardingSphere-Command-2]
org.apache.shardingsphere.sql - Actual SQL: ds_0 ::: INSERT INTO t_user(id,
mobile, idcard) value (10000, '13718687777', '141121xxxxx')
```
Let’s test `SELECT` (repeat it twice):
@@ -160,12 +160,12 @@ mysql> SELECT id, mobile, idcard FROM t_user WHERE id =
10000;
View the ShardingSphere-Proxy log and see if the route node is `ds_1` or
`ds_2`.
```
-[INFO ] 2022-02-28 15:34:07.912 [ShardingSphere-Command-4] ShardingSphere-SQL
- Logic SQL: SELECT id, mobile, idcard FROM t_user WHERE id = 10000
-[INFO ] 2022-02-28 15:34:07.913 [ShardingSphere-Command-4] ShardingSphere-SQL
- SQLStatement: MySQLSelectStatement(table=Optional.empty,
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
-[INFO ] 2022-02-28 15:34:07.913 [ShardingSphere-Command-4] ShardingSphere-SQL
- Actual SQL: ds_1 ::: SELECT id, mobile, idcard FROM t_user WHERE id = 10000
-[INFO ] 2022-02-28 15:34:21.501 [ShardingSphere-Command-4] ShardingSphere-SQL
- Logic SQL: SELECT id, mobile, idcard FROM t_user WHERE id = 10000
-[INFO ] 2022-02-28 15:34:21.502 [ShardingSphere-Command-4] ShardingSphere-SQL
- SQLStatement: MySQLSelectStatement(table=Optional.empty,
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
-[INFO ] 2022-02-28 15:34:21.502 [ShardingSphere-Command-4] ShardingSphere-SQL
- Actual SQL: ds_2 ::: SELECT id, mobile, idcard FROM t_user WHERE id = 10000
+[INFO ] 2022-02-28 15:34:07.912 [ShardingSphere-Command-4]
org.apache.shardingsphere.sql - Logic SQL: SELECT id, mobile, idcard FROM
t_user WHERE id = 10000
+[INFO ] 2022-02-28 15:34:07.913 [ShardingSphere-Command-4]
org.apache.shardingsphere.sql - SQLStatement:
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty,
lock=Optional.empty, window=Optional.empty)
+[INFO ] 2022-02-28 15:34:07.913 [ShardingSphere-Command-4]
org.apache.shardingsphere.sql - Actual SQL: ds_1 ::: SELECT id, mobile, idcard
FROM t_user WHERE id = 10000
+[INFO ] 2022-02-28 15:34:21.501 [ShardingSphere-Command-4]
org.apache.shardingsphere.sql - Logic SQL: SELECT id, mobile, idcard FROM
t_user WHERE id = 10000
+[INFO ] 2022-02-28 15:34:21.502 [ShardingSphere-Command-4]
org.apache.shardingsphere.sql - SQLStatement:
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty,
lock=Optional.empty, window=Optional.empty)
+[INFO ] 2022-02-28 15:34:21.502 [ShardingSphere-Command-4]
org.apache.shardingsphere.sql - Actual SQL: ds_2 ::: SELECT id, mobile, idcard
FROM t_user WHERE id = 10000
```
> **Switch to the primary database**
@@ -204,9 +204,9 @@ Query OK, 1 row affected (0.04 sec)
View the ShardingSphere-Proxy log and see if the route node is the primary
database `ds_1`.
```
-[INFO ] 2022-02-28 15:40:26.784 [ShardingSphere-Command-6] ShardingSphere-SQL
- Logic SQL: INSERT INTO t_user(id, mobile, idcard) value (10001,
'13521207777', '110xxxxx')
-[INFO ] 2022-02-28 15:40:26.784 [ShardingSphere-Command-6] ShardingSphere-SQL
- SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty,
onDuplicateKeyColumns=Optional.empty)
-[INFO ] 2022-02-28 15:40:26.784 [ShardingSphere-Command-6] ShardingSphere-SQL
- Actual SQL: ds_1 ::: INSERT INTO t_user(id, mobile, idcard) value (10001,
'13521207777', '110xxxxx')
+[INFO ] 2022-02-28 15:40:26.784 [ShardingSphere-Command-6]
org.apache.shardingsphere.sql - Logic SQL: INSERT INTO t_user(id, mobile,
idcard) value (10001, '13521207777', '110xxxxx')
+[INFO ] 2022-02-28 15:40:26.784 [ShardingSphere-Command-6]
org.apache.shardingsphere.sql - SQLStatement:
MySQLInsertStatement(setAssignment=Optional.empty,
onDuplicateKeyColumns=Optional.empty)
+[INFO ] 2022-02-28 15:40:26.784 [ShardingSphere-Command-6]
org.apache.shardingsphere.sql - Actual SQL: ds_1 ::: INSERT INTO t_user(id,
mobile, idcard) value (10001, '13521207777', '110xxxxx')
```
Lastly, let’s test `SELECT(repeat it twice):
@@ -218,12 +218,12 @@ mysql> SELECT id, mobile, idcard FROM t_user WHERE id =
10001;
View the ShardingSphere-Proxy log and see if the route node is `ds_2`.
```
-[INFO ] 2022-02-28 15:42:00.651 [ShardingSphere-Command-7] ShardingSphere-SQL
- Logic SQL: SELECT id, mobile, idcard FROM t_user WHERE id = 10001
-[INFO ] 2022-02-28 15:42:00.651 [ShardingSphere-Command-7] ShardingSphere-SQL
- SQLStatement: MySQLSelectStatement(table=Optional.empty,
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
-[INFO ] 2022-02-28 15:42:00.651 [ShardingSphere-Command-7] ShardingSphere-SQL
- Actual SQL: ds_2 ::: SELECT id, mobile, idcard FROM t_user WHERE id = 10001
-[INFO ] 2022-02-28 15:42:02.148 [ShardingSphere-Command-7] ShardingSphere-SQL
- Logic SQL: SELECT id, mobile, idcard FROM t_user WHERE id = 10001
-[INFO ] 2022-02-28 15:42:02.149 [ShardingSphere-Command-7] ShardingSphere-SQL
- SQLStatement: MySQLSelectStatement(table=Optional.empty,
limit=Optional.empty, lock=Optional.empty, window=Optional.empty)
-[INFO ] 2022-02-28 15:42:02.149 [ShardingSphere-Command-7] ShardingSphere-SQL
- Actual SQL: ds_2 ::: SELECT id, mobile, idcard FROM t_user WHERE id = 10001
+[INFO ] 2022-02-28 15:42:00.651 [ShardingSphere-Command-7]
org.apache.shardingsphere.sql - Logic SQL: SELECT id, mobile, idcard FROM
t_user WHERE id = 10001
+[INFO ] 2022-02-28 15:42:00.651 [ShardingSphere-Command-7]
org.apache.shardingsphere.sql - SQLStatement:
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty,
lock=Optional.empty, window=Optional.empty)
+[INFO ] 2022-02-28 15:42:00.651 [ShardingSphere-Command-7]
org.apache.shardingsphere.sql - Actual SQL: ds_2 ::: SELECT id, mobile, idcard
FROM t_user WHERE id = 10001
+[INFO ] 2022-02-28 15:42:02.148 [ShardingSphere-Command-7]
org.apache.shardingsphere.sql - Logic SQL: SELECT id, mobile, idcard FROM
t_user WHERE id = 10001
+[INFO ] 2022-02-28 15:42:02.149 [ShardingSphere-Command-7]
org.apache.shardingsphere.sql - SQLStatement:
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty,
lock=Optional.empty, window=Optional.empty)
+[INFO ] 2022-02-28 15:42:02.149 [ShardingSphere-Command-7]
org.apache.shardingsphere.sql - Actual SQL: ds_2 ::: SELECT id, mobile, idcard
FROM t_user WHERE id = 10001
```
diff --git a/docs/document/content/user-manual/common-config/props.cn.md
b/docs/document/content/user-manual/common-config/props.cn.md
index a07fa1fdded..47e6c7a6508 100644
--- a/docs/document/content/user-manual/common-config/props.cn.md
+++ b/docs/document/content/user-manual/common-config/props.cn.md
@@ -12,7 +12,7 @@ Apache ShardingSphere 提供属性配置的方式配置系统级配置。
| *名称* | *数据类型* | *说明*
| *默认值* |
|------------------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|----------|
-| sql-show (?) | boolean | 是否在日志中打印 SQL<br /> 打印 SQL
可以帮助开发者快速定位系统问题。日志内容包含:逻辑 SQL,真实 SQL 和 SQL 解析结果。<br /> 如果开启配置,日志将使用 Topic
`ShardingSphere-SQL`,日志级别是 INFO | false |
+| sql-show (?) | boolean | 是否在日志中打印 SQL<br /> 打印 SQL
可以帮助开发者快速定位系统问题。日志内容包含:逻辑 SQL,真实 SQL 和 SQL 解析结果。<br /> 如果开启配置,日志将使用 Topic
`org.apache.shardingsphere.sql`,日志级别是 INFO | false |
| sql-simple (?) | boolean | 是否在日志中打印简单风格的 SQL
| false |
| kernel-executor-size (?) | int | 用于设置任务处理线程池的大小<br />每个
ShardingSphereDataSource 使用一个独立的线程池,同一个 JVM 的不同数据源不共享线程池
| infinite |
| max-connections-size-per-query (?) | int | 一次查询请求在每个数据库实例中所能使用的最大连接数
| 1 |
diff --git a/docs/document/content/user-manual/common-config/props.en.md
b/docs/document/content/user-manual/common-config/props.en.md
index 64c5ff75039..17e749ec450 100644
--- a/docs/document/content/user-manual/common-config/props.en.md
+++ b/docs/document/content/user-manual/common-config/props.en.md
@@ -12,7 +12,7 @@ Apache ShardingSphere provides the way of property
configuration to configure sy
| *Name* | *Data Type* | *Description*
| *Default
Value* |
|------------------------------------|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
-| sql-show (?) | boolean | Whether show SQL or not
in log. <br /> Print SQL details can help developers debug easier. The log
details include: logic SQL, actual SQL and SQL parse result. <br /> Enable this
property will log into log topic `ShardingSphere-SQL`, log level is INFO |
false |
+| sql-show (?) | boolean | Whether show SQL or not
in log. <br /> Print SQL details can help developers debug easier. The log
details include: logic SQL, actual SQL and SQL parse result. <br /> Enable this
property will log into log topic `org.apache.shardingsphere.sql`, log level is
INFO | false |
| sql-simple (?) | boolean | Whether show SQL details
in simple style
| false
|
| kernel-executor-size (?) | int | The max thread size of
worker group to execute SQL. One ShardingSphereDataSource will use a
independent thread pool, it does not share thread pool even different data
source in same JVM
| infinite |
| max-connections-size-per-query (?) | int | Max opened connection
size for each query
| 1
|
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.cn.md
index 63e0555e3da..1a865b6c13d 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.cn.md
@@ -12,7 +12,7 @@ Apache ShardingSphere 提供了丰富的系统配置属性,用户可通过 `gl
| *名称* | *数据类型* | *说明*
| *默认值* | *动态生效* |
|-------------------------------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------|-----------------|--------|
-| sql-show (?) | boolean | 是否在日志中打印 SQL。 <br />
打印 SQL 可以帮助开发者快速定位系统问题。日志内容包含:逻辑 SQL,真实 SQL 和 SQL 解析结果。<br /> 如果开启配置,日志将使用
Topic `ShardingSphere-SQL`,日志级别是 INFO。 | false | 是 |
+| sql-show (?) | boolean | 是否在日志中打印 SQL。 <br />
打印 SQL 可以帮助开发者快速定位系统问题。日志内容包含:逻辑 SQL,真实 SQL 和 SQL 解析结果。<br /> 如果开启配置,日志将使用
Topic `org.apache.shardingsphere.sql`,日志级别是 INFO。 | false | 是 |
| sql-simple (?) | boolean | 是否在日志中打印简单风格的 SQL。
| false | 是 |
| kernel-executor-size (?) | int | 用于设置任务处理线程池的大小。每个
ShardingSphereDataSource 使用一个独立的线程池,同一个 JVM 的不同数据源不共享线程池。
| infinite | 否 |
| max-connections-size-per-query (?) | int |
一次查询请求在每个数据库实例中所能使用的最大连接数。
| 1 | 是
|
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.en.md
index d8b31b09803..b5ebcab8860 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/props.en.md
@@ -12,7 +12,7 @@ Apache ShardingSphere provides a wealth of system
configuration properties, whic
| *Name* | *Data Type* | *Description*
| *Default* | *Dynamic Update* |
|-------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|------------------|
-| sql-show (?) | boolean | Whether to print
SQL in logs. <br /> Printing SQL can help developers quickly locate system
problems. Logs contain the following contents: logical SQL, authentic SQL and
SQL parsing result. <br /> If configuration is enabled, logs will use Topic
`ShardingSphere-SQL`, and log level is INFO. | false | True
|
+| sql-show (?) | boolean | Whether to print
SQL in logs. <br /> Printing SQL can help developers quickly locate system
problems. Logs contain the following contents: logical SQL, authentic SQL and
SQL parsing result. <br /> If configuration is enabled, logs will use Topic
`org.apache.shardingsphere.sql`, and log level is INFO. | false |
True |
| sql-simple (?) | boolean | Whether to print
simple SQL in logs.
| false | True |
| kernel-executor-size (?) | int | Set the size of
the thread pool for task processing. Each ShardingSphereDataSource uses an
independent thread pool, and different data sources on the same JVM do not
share thread pools.
| infinite | False
|
| max-connections-size-per-query (?) | int | The maximum number
of connections that a query request can use in each database instance.
| 1 | True |
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 b396dc77be3..cc3ebd8b411 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
@@ -32,7 +32,7 @@ import java.util.Set;
* SQL logger.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-@Slf4j(topic = "ShardingSphere-SQL")
+@Slf4j(topic = "org.apache.shardingsphere.sql")
public final class SQLLogger {
/**
diff --git
a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
index b0dbf342ae8..4889699d71b 100644
---
a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
+++
b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/log/SQLLoggerTest.java
@@ -63,7 +63,7 @@ class SQLLoggerTest {
@SuppressWarnings({"unchecked", "rawtypes"})
@BeforeAll
static void setupLogger() {
- ch.qos.logback.classic.Logger log = (ch.qos.logback.classic.Logger)
LoggerFactory.getLogger("ShardingSphere-SQL");
+ ch.qos.logback.classic.Logger log = (ch.qos.logback.classic.Logger)
LoggerFactory.getLogger("org.apache.shardingsphere.sql");
ListAppender<LoggingEvent> appender = (ListAppender)
log.getAppender("SQLLoggerTestAppender");
appenderList = appender.list;
}
diff --git a/infra/executor/src/test/resources/logback-test.xml
b/infra/executor/src/test/resources/logback-test.xml
index b0686417570..93c70b88131 100644
--- a/infra/executor/src/test/resources/logback-test.xml
+++ b/infra/executor/src/test/resources/logback-test.xml
@@ -29,7 +29,7 @@
<logger
name="org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler"
level="off" />
<appender name="SQLLoggerTestAppender"
class="ch.qos.logback.core.read.ListAppender" />
- <logger name="ShardingSphere-SQL" level="info" additivity="false">
+ <logger name="org.apache.shardingsphere.sql" level="info"
additivity="false">
<appender-ref ref="SQLLoggerTestAppender" />
</logger>
diff --git a/proxy/bootstrap/src/main/resources/conf/global.yaml
b/proxy/bootstrap/src/main/resources/conf/global.yaml
index 6d098f86ceb..d921f7dda30 100644
--- a/proxy/bootstrap/src/main/resources/conf/global.yaml
+++ b/proxy/bootstrap/src/main/resources/conf/global.yaml
@@ -65,7 +65,7 @@
# max-connections-size-per-query: 1
# kernel-executor-size: 16 # Infinite by default.
# proxy-frontend-flush-threshold: 128 # The default value is 128.
-# # sql-show is the same as props in logger ShardingSphere-SQL, and its
priority is lower than logging rule
+# # sql-show is the same as props in logger org.apache.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.