Logging sql queries into file in CakePHP 2

Mar 04, 2012 19:23

Sometimes you need to see sql queries log, but output on webpage is not handy. So, I've created datasource that logs queries into file. It was simple

So, here's what CakePHP says about custom DataSources. The one we need is just an extention of Mysql datasource, so we'll have only one method.

1. Create new file app/Model/Datasource/Database/MysqlEx. ( Read more... )

cakephp

Leave a comment

Comments 4

deosnt work for me anonymous July 9 2013, 20:43:07 UTC
Thanks, I need this, but I cant get it to work.

I assume MysqlEx file should be MysqlEx.php?

I get Missing Datasource and see your file (MysqlEx) output to the top of my main web page.

any ideas?

thanks
Joel

Reply

Re: deosnt work for me volod_0x16 July 11 2014, 10:26:55 UTC
sorry, a bit late
fixed file name

Reply


Error anonymous July 10 2014, 12:55:52 UTC
Missing Datasource

Error: Datasource class MysqlEx could not be found.

Reply

Re: Error volod_0x16 July 11 2014, 10:25:19 UTC
there are 2 options here:
1. you didn't create MysqlEx.php file and class in it
2. something has changed in CakePHP since 2012 ;)

Reply


Leave a comment

Up