Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] add log for sharding logic SQL and real SQL. #596

Closed
dongzl opened this issue Jan 11, 2023 · 4 comments · Fixed by #694 or #705
Closed

[Feature] add log for sharding logic SQL and real SQL. #596

dongzl opened this issue Jan 11, 2023 · 4 comments · Fixed by #694 or #705
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dongzl
Copy link
Contributor

dongzl commented Jan 11, 2023

What would you like to be added:

Why is this needed:

For sharding table, the logic sql will be convert to real sql to execute, so we need to print all the sql for debug.

Logic SQL: SELECT * FROM student where uid = 1;
Physical SQL: node2 : SELECT * FROM student_2 where uid = 1;

and add config for open or close it.

@dongzl dongzl added the enhancement New feature or request label Jan 11, 2023
@dongzl dongzl added this to the 0.2.0 milestone Jan 11, 2023
@dongzl
Copy link
Contributor Author

dongzl commented Jan 14, 2023

  • trace_id sql-param(json)、success or fail、cost time、affect、tx log

@jjeffcaii
Copy link
Contributor

There are many loggers includes:

  • Main logger: record all logs of core component
  • Logical SQL logger: record all logical SQL, for example, select * from student where uid in (1,2,3).
  • Physical SQL logger: record all physical SQL, for example, select * from student_0001 where uid in (1,2,3)...
  • TX logger: record each TX behavior

Should add configuration in bootstrap.yaml, includes:

  • Global log level
  • Is logger enabled? I think the SQL loggers should be disabled by default, except when the global log level is DEBUG, or enabled manually.
  • Is output into console?
  • Log path?

@jjeffcaii
Copy link
Contributor

Read the environment: ARANA_LOG_PATH=/var/log/arana

Logger Default Path Default Level Console Output
Main $ARANA_LOG_PATH/arana.log INFO
Logical SQL $ARANA_LOG_PATH/sql.log DEBUG 🚫
Physical SQL $ARANA_LOG_PATH/physql.log DEBUG 🚫
TX $ARANA_LOG_PATH/tx.log INFO

the SQL/TX logger should print the namespace, for example:
[namespace] $trace_id ...

@maronghe
Copy link
Contributor

maronghe commented Jul 8, 2023

明天提交 MR;

Mulavar added a commit to Mulavar/arana that referenced this issue Jul 11, 2023
1. add composite logger to manage main/sql/tx logger
2. support to parse and propagate the trace context to logging
3. make the logger achieve context level isolation
Mulavar added a commit to Mulavar/arana that referenced this issue Jul 12, 2023
1. add composite logger to manage main/sql/tx logger
2. support to parse and propagate the trace context to logging
3. make the logger achieve context level isolation
Mulavar added a commit to Mulavar/arana that referenced this issue Jul 17, 2023
1. add composite logger to manage main/sql/tx logger
2. support to parse and propagate the trace context to logging
3. make the logger achieve context level isolation
maronghe pushed a commit that referenced this issue Jul 17, 2023
1. add composite logger to manage main/sql/tx logger
2. support to parse and propagate the trace context to logging
3. make the logger achieve context level isolation
Lvnszn pushed a commit to Lvnszn/arana that referenced this issue Jul 22, 2023
1. add composite logger to manage main/sql/tx logger
2. support to parse and propagate the trace context to logging
3. make the logger achieve context level isolation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
6 participants