Re: How to Log Warnings and Errors from queries
Hi Rithish, Thank you all for your suggestion, I would definitely give it a shot. Regards, Ryan. On 3/13/06, Rithish Saralaya <[EMAIL PROTECTED]> wrote: > > Hello Ryan. I am more of a developer than a MySQL administrator. Hence, I > would always favour applications logging query errors rather than being > dependent on MySQL to generate a log for me. Of course, I may be wrong. > > You could write a query execution function, say exec_mysql_query(...) in > one > of you files, say 'Db.inc' and have it included in all your files. > > exec_mysql_query(...) will log all mysql errors into a file. and you may > provide an web-interface (assuming this is a web application) to > view/download the log files. > > Regards, > Rithish. > > > > -Original Message- > From: ryan lwf [mailto:[EMAIL PROTECTED] > Sent: Friday, March 10, 2006 8:14 PM > To: Dan Nelson > Cc: mysql@lists.mysql.com > Subject: Re: How to Log Warnings and Errors from queries > > > Hi Dan, > > Noted with thanks. > > As such, is there a workaround to log problematic sql queries ran against > the mysqld server ? Do I need to write separate script to do this ? > > Regards, > Ryan. > > On 3/10/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > > > > In the last episode (Mar 08), ryan lwf said: > > > I understand that the option log-errors and log-warnings only logs > > > server related internal errors. How do I enable logging errors from > > > queries executed, so that I can fix the problematic query statement > > > accordingly? > > > > > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my > > > server with mysqld-4.0.25 binary version. > > > > Those commands appeared in MySQL 4.1. Before then, warnings were > > simply counted. > > > > -- > >Dan Nelson > >[EMAIL PROTECTED] > > > >
RE: How to Log Warnings and Errors from queries
Hello Ryan. I am more of a developer than a MySQL administrator. Hence, I would always favour applications logging query errors rather than being dependent on MySQL to generate a log for me. Of course, I may be wrong. You could write a query execution function, say exec_mysql_query(...) in one of you files, say 'Db.inc' and have it included in all your files. exec_mysql_query(...) will log all mysql errors into a file. and you may provide an web-interface (assuming this is a web application) to view/download the log files. Regards, Rithish. -Original Message- From: ryan lwf [mailto:[EMAIL PROTECTED] Sent: Friday, March 10, 2006 8:14 PM To: Dan Nelson Cc: mysql@lists.mysql.com Subject: Re: How to Log Warnings and Errors from queries Hi Dan, Noted with thanks. As such, is there a workaround to log problematic sql queries ran against the mysqld server ? Do I need to write separate script to do this ? Regards, Ryan. On 3/10/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > > In the last episode (Mar 08), ryan lwf said: > > I understand that the option log-errors and log-warnings only logs > > server related internal errors. How do I enable logging errors from > > queries executed, so that I can fix the problematic query statement > > accordingly? > > > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my > > server with mysqld-4.0.25 binary version. > > Those commands appeared in MySQL 4.1. Before then, warnings were > simply counted. > > -- >Dan Nelson >[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How to Log Warnings and Errors from queries
There are some scripts that help us to save logs, For example: log4php You write your app and when you're testing it you define a level to save the errors into a file and display them in your app but in production the client doesn't have to see the errors, only the developers, so, in your log4php define that only write the errors into a log file. This is a easy way to control the errors logs, without re-write your scripts, for example: Testing: Mysql_query($sql) or die(mysql_error()." $sql"); Production: Mysql_query($sql) or die(saveLog(mysql_error()." $sql")); Regards! Edwin. -Mensaje original- De: Subscriptions [mailto:[EMAIL PROTECTED] Enviado el: Viernes, 10 de Marzo de 2006 10:27 a.m. Para: mysql@lists.mysql.com Asunto: Re: How to Log Warnings and Errors from queries In PHP, you can see the error message as follows: $result = mysql_query($sSQL) or die ("".mysql_error() ."".$sSQL); Just change it to write that mysql_error() to a file instead and that'll do it. So, something like: $result = mysql_query($sSQL) or die ( log_error(mysql_error()) ); where you create that function log_error to write to a file. Jenifer - Original Message - From: "Kishore Jalleda" <[EMAIL PROTECTED]> To: "ryan lwf" <[EMAIL PROTECTED]> Cc: "Dan Nelson" <[EMAIL PROTECTED]>; Sent: Friday, March 10, 2006 10:03 AM Subject: Re: How to Log Warnings and Errors from queries as you know mysql gives you an error to check your sql syntax when it doesn't understand a query but does not log it , but you can have your application (php, perl, etc ) accessing mysql to log any bad/malformed queries... Kishore Jalleda On 3/10/06, ryan lwf <[EMAIL PROTECTED]> wrote: > Hi Dan, > > Noted with thanks. > > As such, is there a workaround to log problematic sql queries ran > against the mysqld server ? Do I need to write separate script to do > this ? > > Regards, > Ryan. > > On 3/10/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > > > > In the last episode (Mar 08), ryan lwf said: > > > I understand that the option log-errors and log-warnings only logs > > > server related internal errors. How do I enable logging errors > > > from queries executed, so that I can fix the problematic query > > > statement accordingly? > > > > > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on > > > my server with mysqld-4.0.25 binary version. > > > > Those commands appeared in MySQL 4.1. Before then, warnings were > > simply counted. > > > > -- > >Dan Nelson > >[EMAIL PROTECTED] > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: How to Log Warnings and Errors from queries
In PHP, you can see the error message as follows: $result = mysql_query($sSQL) or die ("".mysql_error() ."".$sSQL); Just change it to write that mysql_error() to a file instead and that'll do it. So, something like: $result = mysql_query($sSQL) or die ( log_error(mysql_error()) ); where you create that function log_error to write to a file. Jenifer - Original Message - From: "Kishore Jalleda" <[EMAIL PROTECTED]> To: "ryan lwf" <[EMAIL PROTECTED]> Cc: "Dan Nelson" <[EMAIL PROTECTED]>; Sent: Friday, March 10, 2006 10:03 AM Subject: Re: How to Log Warnings and Errors from queries as you know mysql gives you an error to check your sql syntax when it doesn't understand a query but does not log it , but you can have your application (php, perl, etc ) accessing mysql to log any bad/malformed queries... Kishore Jalleda On 3/10/06, ryan lwf <[EMAIL PROTECTED]> wrote: Hi Dan, Noted with thanks. As such, is there a workaround to log problematic sql queries ran against the mysqld server ? Do I need to write separate script to do this ? Regards, Ryan. On 3/10/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > > In the last episode (Mar 08), ryan lwf said: > > I understand that the option log-errors and log-warnings only logs > > server related internal errors. How do I enable logging errors from > > queries executed, so that I can fix the problematic query statement > > accordingly? > > > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my > > server with mysqld-4.0.25 binary version. > > Those commands appeared in MySQL 4.1. Before then, warnings were > simply counted. > > -- >Dan Nelson >[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: How to Log Warnings and Errors from queries
as you know mysql gives you an error to check your sql syntax when it doesn't understand a query but does not log it , but you can have your application (php, perl, etc ) accessing mysql to log any bad/malformed queries... Kishore Jalleda On 3/10/06, ryan lwf <[EMAIL PROTECTED]> wrote: > Hi Dan, > > Noted with thanks. > > As such, is there a workaround to log problematic sql queries ran against > the mysqld server ? Do I need to write separate script to do this ? > > Regards, > Ryan. > > On 3/10/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > > > > In the last episode (Mar 08), ryan lwf said: > > > I understand that the option log-errors and log-warnings only logs > > > server related internal errors. How do I enable logging errors from > > > queries executed, so that I can fix the problematic query statement > > > accordingly? > > > > > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my > > > server with mysqld-4.0.25 binary version. > > > > Those commands appeared in MySQL 4.1. Before then, warnings were > > simply counted. > > > > -- > >Dan Nelson > >[EMAIL PROTECTED] > > > >
Re: How to Log Warnings and Errors from queries
Hi Dan, Noted with thanks. As such, is there a workaround to log problematic sql queries ran against the mysqld server ? Do I need to write separate script to do this ? Regards, Ryan. On 3/10/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > > In the last episode (Mar 08), ryan lwf said: > > I understand that the option log-errors and log-warnings only logs > > server related internal errors. How do I enable logging errors from > > queries executed, so that I can fix the problematic query statement > > accordingly? > > > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my > > server with mysqld-4.0.25 binary version. > > Those commands appeared in MySQL 4.1. Before then, warnings were > simply counted. > > -- >Dan Nelson >[EMAIL PROTECTED] >
Re: How to Log Warnings and Errors from queries
In the last episode (Mar 08), ryan lwf said: > I understand that the option log-errors and log-warnings only logs > server related internal errors. How do I enable logging errors from > queries executed, so that I can fix the problematic query statement > accordingly? > > The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my > server with mysqld-4.0.25 binary version. Those commands appeared in MySQL 4.1. Before then, warnings were simply counted. -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How to Log Warnings and Errors from queries
Hi all, I understand that the option log-errors and log-warnings only logs server related internal errors. How do I enable logging errors from queries executed, so that I can fix the problematic query statement accordingly? The statement "SHOW WARNINGS" and "SHOW ERRORS" does not work on my server with mysqld-4.0.25 binary version. Any inputs are appreciated. Thanks, Ryan.