views:

45

answers:

2

Hi All,

I am using Kohana 3. I want to log the MySQL queries being executed by an application. The reason to determine the query of type INSERT,UPDATE and DELETE which are being executed in a process and store them in another MySQL table with date-time for further reference.

Can anybody tell how can I achieve this?

A: 

I did this using after() method of the controller. After execution of each controller action this after() method is executed, where I wrote logic to capture last query executed and stored in my db for further reference.

Asif
A: 

An alternative is to enable profiling for the database module, which will log the queries made to a file. This will log ALL queries, not just the last one ;)

It shouldn't be too hard to parse the file, or to extend the profiling/logging/caching classes to save it to a database.

Lethargy