mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
0c4e184bde
Added slow_query_log & general_log global upadatable variables. Added slow-query-log & general-log startup options. Added log_output, general_log_file, slow_query_log_file global updatable variables. mysql-test/r/show_check.result: WL#3015: Logging Improvements - No Restarts result fix sql/log.cc: WL#3015: Logging Improvements - No Restarts added methods to LOGGER class void deactivate_log_handlers(THD* thd, uint log_type); bool activate_log_handlers(THD* thd, uint log_type); added methods to Log_to_file_event_handler: TABLE_LIST *get_mysql_slow_log() TABLE_LIST *get_mysql_log() sql/log.h: WL#3015: Logging Improvements - No Restarts added methods to LOGGER class void deactivate_log_handlers(THD* thd, uint log_type); bool activate_log_handlers(THD* thd, uint log_type); added methods to Log_to_file_event_handler: TABLE_LIST *get_mysql_slow_log() TABLE_LIST *get_mysql_log() sql/mysql_priv.h: WL#3015: Logging Improvements - No Restarts sql/mysqld.cc: WL#3015: Logging Improvements - No Restarts added 'slow-query-log' & 'general-log' options sql/set_var.cc: WL#3015: Logging Improvements - No Restarts added 'slow_query_log' & 'general_log' updatable variables added 'log_output', 'general_log_file', 'slow_query_log_file' updatable variables sql/set_var.h: WL#3015: Logging Improvements - No Restarts new class sys_var_log_state new class sys_var_log_output sql/share/errmsg.txt: WL#3015: Logging Improvements - No Restarts added error message sql/sql_delete.cc: WL#3015: Logging Improvements - No Restarts 'truncate table slow_log|general', keep status of logs
155 lines
5.2 KiB
Text
155 lines
5.2 KiB
Text
set global general_log= OFF;
|
|
truncate table mysql.general_log;
|
|
truncate table mysql.slow_log;
|
|
show global variables
|
|
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
|
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
|
|
Variable_name Value
|
|
general_log OFF
|
|
log OFF
|
|
log_slow_queries OFF
|
|
slow_query_log OFF
|
|
flush logs;
|
|
set global general_log= ON;
|
|
create table t1(f1 int);
|
|
select * from mysql.general_log;
|
|
event_time user_host thread_id server_id command_type argument
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query create table t1(f1 int)
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query select * from mysql.general_log
|
|
set global general_log= OFF;
|
|
drop table t1;
|
|
select * from mysql.general_log;
|
|
event_time user_host thread_id server_id command_type argument
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query create table t1(f1 int)
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query select * from mysql.general_log
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query set global general_log= OFF
|
|
set global general_log= ON;
|
|
flush logs;
|
|
show global variables
|
|
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
|
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
|
|
Variable_name Value
|
|
general_log ON
|
|
log ON
|
|
log_slow_queries OFF
|
|
slow_query_log OFF
|
|
set session long_query_time=1;
|
|
select sleep(2);
|
|
sleep(2)
|
|
0
|
|
select * from mysql.slow_log;
|
|
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
|
|
set global slow_query_log= ON;
|
|
set session long_query_time=1;
|
|
select sleep(2);
|
|
sleep(2)
|
|
0
|
|
select * from mysql.slow_log;
|
|
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
|
|
TIMESTAMP, root[root] @ localhost [] USER_HOST, QUERY_TIME 1 0 test 0 0 1 select sleep(2)
|
|
show global variables
|
|
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
|
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
|
|
Variable_name Value
|
|
general_log ON
|
|
log ON
|
|
log_slow_queries ON
|
|
slow_query_log ON
|
|
set global general_log= ON;
|
|
set global general_log= OFF;
|
|
set global general_log= OFF;
|
|
set global slow_query_log= ON;
|
|
set global slow_query_log= OFF;
|
|
set global slow_query_log= OFF;
|
|
set global general_log= ON;
|
|
truncate table mysql.general_log;
|
|
create table t1(f1 int);
|
|
drop table t1;
|
|
select * from mysql.general_log;
|
|
event_time user_host thread_id server_id command_type argument
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query create table t1(f1 int)
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query drop table t1
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query select * from mysql.general_log
|
|
set global general_log= OFF;
|
|
truncate table mysql.general_log;
|
|
select * from mysql.general_log;
|
|
event_time user_host thread_id server_id command_type argument
|
|
set global general_log= ON;
|
|
show global variables
|
|
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
|
|
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
|
|
Variable_name Value
|
|
general_log ON
|
|
log ON
|
|
log_slow_queries OFF
|
|
slow_query_log OFF
|
|
show variables like 'general_log_file';
|
|
Variable_name Value
|
|
general_log_file #
|
|
show variables like 'slow_query_log_file';
|
|
Variable_name Value
|
|
slow_query_log_file #
|
|
show variables like 'log_output';
|
|
Variable_name Value
|
|
log_output FILE,TABLE
|
|
set global general_log_file='/not exiting path/log.master';
|
|
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
|
|
set global general_log_file='/tmp';
|
|
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/tmp'
|
|
set global general_log_file='';
|
|
ERROR 42000: Variable 'general_log_file' can't be set to the value of ''
|
|
show variables like 'general_log_file';
|
|
Variable_name Value
|
|
general_log_file #
|
|
set global general_log= OFF;
|
|
set global general_log_file='/tmp/log.master';
|
|
set global general_log= ON;
|
|
create table t1(f1 int);
|
|
drop table t1;
|
|
set global general_log= OFF;
|
|
set global general_log_file=default;
|
|
set global general_log= ON;
|
|
create table t1(f1 int);
|
|
drop table t1;
|
|
show variables like 'general_log_file';
|
|
Variable_name Value
|
|
general_log_file #
|
|
show variables like 'slow_query_log_file';
|
|
Variable_name Value
|
|
slow_query_log_file #
|
|
set global general_log= default;
|
|
set global slow_query_log= default;
|
|
set global general_log_file= default;
|
|
set global slow_query_log_file= default;
|
|
show variables like 'general_log';
|
|
Variable_name Value
|
|
general_log OFF
|
|
show variables like 'slow_query_log';
|
|
Variable_name Value
|
|
slow_query_log OFF
|
|
set global general_log=ON;
|
|
set global log_output=default;
|
|
show variables like 'log_output';
|
|
Variable_name Value
|
|
log_output TABLE
|
|
set global general_log=OFF;
|
|
set global log_output=FILE;
|
|
truncate table mysql.general_log;
|
|
show variables like 'log_output';
|
|
Variable_name Value
|
|
log_output FILE
|
|
set global general_log=ON;
|
|
create table t1(f1 int);
|
|
select * from mysql.general_log;
|
|
event_time user_host thread_id server_id command_type argument
|
|
set global general_log=OFF;
|
|
set global log_output="FILE,TABLE";
|
|
show variables like 'log_output';
|
|
Variable_name Value
|
|
log_output FILE,TABLE
|
|
set global general_log=ON;
|
|
drop table t1;
|
|
select * from mysql.general_log;
|
|
event_time user_host thread_id server_id command_type argument
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query drop table t1
|
|
TIMESTAMP root[root] @ localhost [] # 1 Query select * from mysql.general_log
|