Description:
If you set the general_log_file or slow_query_log file
system variables with the general log or slow query
log enabled, log output should go to the new file.
This works for general_log_file, but not for
slow_query_log_file. What happens instead is
that slow log output goes to the general log.
The example below shows how to demonstrate
this. Note that the example is restricted only to
showing that the initial slow log header lines go
to the general log. I suppose it's possible that
further slow log output would actually go to the
slow log, but there is still a bug.
How to repeat:
Initial configuration is that I have logging to files enabled for the general
query log and the slow query log:
mysql> show variables like '%log%';
...
| general_log | ON |
| general_log_file | qlog |
...
| log | ON |
| log_output | FILE |
| log_slow_queries | ON |
...
| slow_query_log | ON |
| slow_query_log_file | slow-log |
...
Now, switch to a different general log file:
mysql> set global general_log_file='/tmp/mylog';
Query OK, 0 rows affected (0.40 sec)
/tmp/mylog is created and its contents at this point look like this:
% cat /tmp/mylog
/var/mysql/50113/libexec/mysqld, Version: 5.1.13-beta-debug-log (Source distribution). started with:
Tcp port: 50113 Unix socket: /var/mysql/50113/mysql.sock
Time Id Command Argument
Now, switch to a different slow query log file:
mysql> set global slow_query_log_file='/tmp/myslowlog';
Query OK, 0 rows affected (0.04 sec)
/tmp/myslowlog is *not* created, and the header lines that should
have been written to it have gone to /tmp/mylog:
% cat /tmp/mylog
/var/mysql/50113/libexec/mysqld, Version: 5.1.13-beta-debug-log (Source distribution). started with:
Tcp port: 50113 Unix socket: /var/mysql/50113/mysql.sock
Time Id Command Argument
061012 12:47:53 1 Query set global slow_query_log_file='/tmp/myslowlog'
/var/mysql/50113/libexec/mysqld, Version: 5.1.13-beta-debug-log (Source distribution). started with:
Tcp port: 50113 Unix socket: /var/mysql/50113/mysql.sock
Time Id Command Argument
Now, switch to a different slow query log file again:
mysql> set global slow_query_log_file='/tmp/myslowlog2';
Query OK, 0 rows affected (0.03 sec)
Again, /tmp/myslowlog is *not* created, and the header lines that should
have been written to it have gone to /tmp/mylog:
% cat /tmp/mylog
/var/mysql/50113/libexec/mysqld, Version: 5.1.13-beta-debug-log (Source distribution). started with:
Tcp port: 50113 Unix socket: /var/mysql/50113/mysql.sock
Time Id Command Argument
061012 12:47:53 1 Query set global slow_query_log_file='/tmp/myslowlog'
/var/mysql/50113/libexec/mysqld, Version: 5.1.13-beta-debug-log (Source distribution). started with:
Tcp port: 50113 Unix socket: /var/mysql/50113/mysql.sock
Time Id Command Argument
061012 12:48:12 1 Query set global slow_query_log_file='/tmp/myslowlog2'
/var/mysql/50113/libexec/mysqld, Version: 5.1.13-beta-debug-log (Source distribution). started with:
Tcp port: 50113 Unix socket: /var/mysql/50113/mysql.sock
Time Id Command Argument