Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
-none-

-none-

2007-10-08       - By Baron Schwartz

 Back
I had a server crash over the weekend and discovered that I don't know
as much about MySQL error logging as I thought.  The error logs were
empty because of FLUSH LOGS.

What I learned today is if I specify the log-errors parameter in
/etc/mysql/my.cnf, every time there's a FLUSH LOGS (or mysqld catches a
SIGHUP), it rotates the error log to -old, like this:

Here's the config file line:
log-error = /var/log/mysql/mysqld.err

And here's the directory:

$ ls -l /var/log/mysql/
-rw-rw---- 1 mysql mysql       0 Jul 11 08:40 mysql.err
-rw-rw---- 1 mysql mysql 1617643 Oct  8 11:26 mysqld.err
-rw-rw---- 1 mysql mysql   61984 Oct  8 11:22 mysqld.err-old

I created those logs by deliberately making InnoDB spit out some output
with the InnoDB Lock Monitor, then did a FLUSH LOGS, and mysqld itself
moved mysqld.err to mysqld.err-old.

If I don't specify log-error, it doesn't log anything (duh).  In this
case, the output goes where?  to mysql.err instead of mysqld.err?  No,
that file is created by mysqld_safe and never seems to get anything
written to it.  It seems to go to /dev/null, or maybe it just isn't
logging anything at all when log-error isn't specified.

The problem here is that the renaming is throwing away my error
messages, which I need to debug a problem.  And I don't just want this
file written in the data directory, so I don't want to omit the filename
and let MySQL choose where the file goes (which appears to be the only
way to avoid the auto-renaming behavior, according to the manual section
5.11.1).

I do not like this auto-rotating behavior.  I want to use logrotate to
handle this.  Is there any way I can configure MySQL to just log to the
specified file, do a close-and-reopen when I run FLUSH LOGS like it does
for the other logs, and use logrotate to rotate the files myself?

Thanks
Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@(protected)