[fw-general] logging offending queries

2008-12-03 Thread Ralikwen

Hi,
is there a generic way to log all database calls from ZF? Or log all db
errors?

I know that I can use the profiler - I use it with Firebug and it works
nicely with successful queries - but gives me no help when a db error
occurs.
When a db error occurs I would like to see the offending statement without
having to write spec code to every db call. Even the stack trace could help
if only it displayed the whole sql statement instead of just the beginning
of it. I searched quite a lot now but couldn't find an example of a generic
way to log sql statement or even sql errors.

How would you do this?

Thanks for the help.
SWK
-- 
View this message in context: 
http://www.nabble.com/logging-offending-queries-tp20800359p20800359.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] logging offending queries

2008-12-03 Thread Daniel Latter
Hi,

Just an idea but you could have a base class (maybe extend
Zend_Db_Table) and put some custom code in here that does the logging,
that way you would only have to add the logging code in one place.

just my 2p

Thank You
Daniel Latter



2008/12/2 Ralikwen [EMAIL PROTECTED]:

 Hi,
 is there a generic way to log all database calls from ZF? Or log all db
 errors?

 I know that I can use the profiler - I use it with Firebug and it works
 nicely with successful queries - but gives me no help when a db error
 occurs.
 When a db error occurs I would like to see the offending statement without
 having to write spec code to every db call. Even the stack trace could help
 if only it displayed the whole sql statement instead of just the beginning
 of it. I searched quite a lot now but couldn't find an example of a generic
 way to log sql statement or even sql errors.

 How would you do this?

 Thanks for the help.
 SWK
 --
 View this message in context: 
 http://www.nabble.com/logging-offending-queries-tp20800359p20800359.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] logging offending queries

2008-12-03 Thread Tim Nagel
Have you looked at the Zend_Db profiler? We use it to log queries to
FirePHP.



T

On Thu, Dec 4, 2008 at 02:25, Daniel Latter [EMAIL PROTECTED] wrote:

 Hi,

 Just an idea but you could have a base class (maybe extend
 Zend_Db_Table) and put some custom code in here that does the logging,
 that way you would only have to add the logging code in one place.

 just my 2p

 Thank You
 Daniel Latter



 2008/12/2 Ralikwen [EMAIL PROTECTED]:
  
  Hi,
  is there a generic way to log all database calls from ZF? Or log all db
  errors?
 
  I know that I can use the profiler - I use it with Firebug and it works
  nicely with successful queries - but gives me no help when a db error
  occurs.
  When a db error occurs I would like to see the offending statement
 without
  having to write spec code to every db call. Even the stack trace could
 help
  if only it displayed the whole sql statement instead of just the
 beginning
  of it. I searched quite a lot now but couldn't find an example of a
 generic
  way to log sql statement or even sql errors.
 
  How would you do this?
 
  Thanks for the help.
  SWK
  --
  View this message in context:
 http://www.nabble.com/logging-offending-queries-tp20800359p20800359.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 



Re: [fw-general] logging offending queries

2008-12-03 Thread Ralikwen

You mean : Zend_Db_Profiler_Firebug('All DB Queries') ?
Yes, I did try that and I thought wow, fantastic, but it seems to me that it
only logs successful queries so e.g. queries with a syntax error would not
get logged - which would be logical for a profiler that needs start and end
time.



Tim Nagel wrote:
 
 Have you looked at the Zend_Db profiler? We use it to log queries to
 FirePHP.
 
 

-- 
View this message in context: 
http://www.nabble.com/logging-offending-queries-tp20800359p20823628.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] logging offending queries

2008-12-03 Thread till
On Wed, Dec 3, 2008 at 11:58 PM, Ralikwen [EMAIL PROTECTED] wrote:

 You mean : Zend_Db_Profiler_Firebug('All DB Queries') ?
 Yes, I did try that and I thought wow, fantastic, but it seems to me that it
 only logs successful queries so e.g. queries with a syntax error would not
 get logged - which would be logical for a profiler that needs start and end
 time.

Can you explain that? I was always under the impression that errors
are thrown with an exception - so in your case that is where I would
log the offenders? Just a wild guess but that's what I'd do. But maybe
I didn't get the full picture.

Also, there are services like getexceptional.com that allow you to
post exceptions to a webservice and you get all your errors in a very
pretty interface. There's a PHP class on github (shameless plug) -
http://github.com/till/exceptional-php/tree/master. So basically
what it does is, it intercepts the standard exception handler, hands
it off to getexceptional.com and then it continues with whatever your
app does with the errors usually.


Cheers,
Till