Solved

Force Error to be written to MySQL's error log

Posted on 2006-07-17
6
463 Views
Last Modified: 2012-05-05
I'm currently running MySQL 4.1.12 and was wondering if it is possible to force an error message to be written to the MySQL error log.  I'm new to MySQL but have worked with SQL Server for over 10 years.  In SQL Server you were allowed to raise an error and depending on the severity level you passed it, it could be written to the SQL Server error log.  

I'm interested in doing this because we are having issues with the MySQL error log - nothing is being written to it.  I'm figuring if I can at least attempt a way of forcing a bogus error message to the error log, then I can do fruther testing to see if MySQL is actually writing to the MySQL error log.

Thanks for your help in advance!
Patty Hernon
0
Comment
Question by:pattyhernon
  • 2
  • 2
6 Comments
 
LVL 6

Expert Comment

by:chigs20
ID: 17125523
Patty,
Have you enabled error logging in the my.cnf (linux) / my.ini (windows) file? (this is not done automatically during installation)

Linux it'll be output to default installation location = hostname.err

Windows: If you do not specify --log-error and if you use the --console option, errors are written to stderr, the standard error output. Usually this is your terminal.

Chigs
0
 

Author Comment

by:pattyhernon
ID: 17130131
Hi Chigs:

Thanks for the quick reply.  We are running on a linux server and error logging is configured in the my.cnf file (err-log=/var/log/mysqld.log).  

We do get some messages written to the error log if we stop and restart MySQL.  (See below for example.)  
>>> Sample of error log <<<
060715 09:05:17  mysqld ended
060715 09:10:36  mysqld started
060715  9:10:39  InnoDB: Started; log sequence number 713 591460636 /usr/libexec/mysqld: ready for connections.
Version: '4.1.12-log'  socket: '/export/DB/mysqldb/mysql.sock'  port: 3306  Source distribution
>>>>>>>>>>>>>>>>>>>>

Once MySQL is up and running, we do not get anymore error messages and at some point it stops.  I find it really hard to believe that MySQL can be running for 2 months without any kind of problems or warnings occurring?  So my thinking was if I could manually focus an error message to be written to the error log, it would help me in figuring out the problem I'm really trying to fix.

Any ideas if this type of function is possible?

Thanks,
Patty
0
 
LVL 6

Expert Comment

by:chigs20
ID: 17131360
Patty,
I tried creating db's and improper tables which forces errors (e.g. create table test (id int unsigned NOT NU);) but those do not get written to the log, which is odd.  If you have a development environment you can change the my.cnf file and set parameters ridiculously high:

sort_buffer_size = 10M
read_buffer_size = 10M
join_buffer_size = 10M
innodb_buffer_pool_size = 500M
etc...
Then connect to the server with many threads and eventually the server will crash because of the lack of RAM (depending on how much RAM you have):
Min_RAM_Needed = global params + (thread params * max_connections)

0
 

Author Comment

by:pattyhernon
ID: 17157200
Hi Chigs:

Again, Thanks for the quick reply and suggestions.

It turns out that a co-worker knows what's going on.  It's basically a problem with MySQL's error log that I'm trying to track down and figured that if I could figure out a way to force an error message to the error log, it would help me in troubleshooting the real problem.  

To make a long story short, it turns out the problem is with Linux (RedHat's) log rotation.  It's is not renaming \ re-opening the correct error log file.   (Here's the link for the bug: http://bugs.mysql.com/bug.php?id=6061).  

Thanks for all your suggestions.  It was much appreciated.

Take care!
Patty
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17586318
PAQed with points refunded (125)

DarthMod
Community Support Moderator
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question