List:General Discussion« Previous MessageNext Message »
From:Subscriptions Date:March 10 2006 4:26pm
Subject:Re: How to Log Warnings and Errors from queries
View as plain text  
In PHP, you can see the error message as follows:

$result = mysql_query($sSQL) or die ("<br>".mysql_error() 
."<br><br>".$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" <kjalleda@stripped>
To: "ryan lwf" <ryanlwf@stripped>
Cc: "Dan Nelson" <dnelson@stripped>; <mysql@stripped>
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 <ryanlwf@stripped> 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 <dnelson@stripped> 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
> >        dnelson@stripped
> >
>
>

Thread
How to Log Warnings and Errors from queriesryan lwf10 Mar
  • Re: How to Log Warnings and Errors from queriesDan Nelson10 Mar
    • Re: How to Log Warnings and Errors from queriesryan lwf10 Mar
      • Re: How to Log Warnings and Errors from queriesKishore Jalleda10 Mar
      • RE: How to Log Warnings and Errors from queriesRithish Saralaya13 Mar
        • Re: How to Log Warnings and Errors from queriesryan lwf13 Mar
  • Re: How to Log Warnings and Errors from queriesSubscriptions10 Mar
    • RE: How to Log Warnings and Errors from queriesIng. Edwin Cruz10 Mar