Print magento Sql at run time

Any developer wants to check what sql is executing during page load. so he can check and identify the getting errors:

To print the sql go to folder :

app\code\core\Mage\Catalog\Model\

and open file Layer.php

search the function :


and replace :


to

printlogquery(true);
    return $collection;
?>

and save and run front page again… you will see all Sqls are showing on the page.


Comments

One response to “Print magento Sql at run time”

Leave a Reply

Your email address will not be published. Required fields are marked *

*