Solved

Force Error to be written to MySQL's error log

Posted on 2006-07-17
6
469 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Complex MySQL Query 2 46
Help With Simple Database Design 7 68
java mysql insert application 14 64
Formating field inside mysql query 2 45
More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

740 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