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
Solved

Force Error to be written to MySQL's error log

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql_mode 1 30
Using coldfusion <cfexecute> to restore mysql database 7 47
reverse engineer .sql from php files 11 34
issue with DB import 1 17
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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