Solved

Force Error to be written to MySQL's error log

Posted on 2006-07-17
6
460 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now