How can I log all the queries in a single file ?
QApplication::$Database[1]->OutputProfiling() is a good start but i don't want to click on a link to see the queries.
I can't activate mysql logging and I found a way to use the generated model and extend it but because columns can change to the table I don't want to update the extended class manually with the new fields each time.
Do you want to log the queries for development purposes (i.e. try to make individual pages faster)? Or for some other reason?
For example I need to log all the INSERT queries and on production I can't activate the profiler.
Ummm how exactly are you planning to use the results of this log? Is this for auditing purposes? I.e. to see which user did what operation?
Can you give the desired format of the log? Is it something like this:
Timestamp QuerySQL
Or something fancier, like
Timestamp UserID QuerySQL
Timestamp QuerySQL should be enough.
I can't activate mysql logging and I found a way to use the generated model and extend it but because columns can change to the table I don't want to update the extended class manually with the new fields each time.
Do you have any suggestions?
Write your own database adapter class that extends from one of the existing classes. In that class, override the LogQuery method to write to the file.
Great solution.
Thank you
My pleasure. Best of luck to you!