Bug #3571 flush logs doesn't flush error log, if log-error is not set
Submitted: 26 Apr 2004 17:05 Modified: 27 Apr 2004 7:11
Reporter: Timothy Smith Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.19 OS:Unix
Assigned to: Sergei Golubchik CPU Architecture:Any

[26 Apr 2004 17:05] Timothy Smith
Description:
If log-error is set, then 'flush logs' command renames error log to foo-old and starts a new error log.  If it's not set, then the error log isn't flushed.

How to repeat:
tim@sand:~/m/40m$ (mysqld_safe --skip-networking &)
tim@sand:~/m/40m$ Starting mysqld daemon with databases from /home/tim/m/40m/data
ls data/*err*                    
data/sand.box.err
tim@sand:~/m/40m$ mysql -e 'flush logs'            
tim@sand:~/m/40m$ ls data/*err*        
data/sand.box.err
tim@sand:~/m/40m$ mysqladmin shut
040426 17:52:37  mysqld ended

The error log didn't get flushed.

Now, I add this line to ~/.my.cnf in the [server] section:
log-error=/home/tim/m/40m/data/foo.err

tim@sand:~/m/40m$ (mysqld_safe --skip-networking &)
tim@sand:~/m/40m$ Starting mysqld daemon with databases from /home/tim/m/40m/data

tim@sand:~/m/40m$ ls data/*err*                    
data/foo.err      data/sand.box.err
tim@sand:~/m/40m$ mysql -e 'flush logs'            
tim@sand:~/m/40m$ ls data/*err*        
data/foo.err      data/foo.err-old  data/sand.box.err
tim@sand:~/m/40m$ mysqladmin shut
040426 17:50:06  mysqld ended

Now the error log is flushed.

Suggested fix:
Change the initialization of opt_error_log in mysqld.cc:

bool opt_error_log= IF_WIN(1,0);

to:

bool opt_error_log= 1;

There may be more involved than that.
[27 Apr 2004 7:11] Sergei Golubchik
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

no way to do it. If log-error is not specified, errors are logged into stderr and mysqld_safe redirects them to a file. mysqld itself has no way of rotating the log.