Using Zend_Db_Profiler_Firebug to show database queries per page

Although ZFDebug is a great tool, it does require you to show the toolbar when you need to check something. Whilst this is fine for developers or administrators, it’ll probably confuse regular users. Therefore if you’re trying to debug something a regular user is doing, you may need another way to see what database queries are being run.

Luckily Zend Framework has both a logger and a database profiler that can send info straight to Firebug. By using Zend_Db_Profiler_Firebug you can profile the database and send that information to the Firebug console.

$profiler = new Zend_Db_Profiler_Firebug('My database queries');
$resource = $this->getPluginResource('multidb');
$database = $resource->getDb('default');

Pretty much like setting up a normal Zend_Db profiler, except now you’ll see the results in Firebug. You will need to enable the Net panel in Firebug in order to get it to output the queries to the console.

Add comment