How to turn on debugging and development mode in Magento

1. Turn off the caching to eliminate the need to re-caching after some changes are made in the source code.

2. Turn on the error reporting, so it will print the error on the page when there are errors. The error log is stored under magentoHOME/var/report. To turn on the error reporting, renaming the file magentoHOME/errors/local.xml.sample to magentoHOME/errors/local.xml

3. Turn on the php debug mode. put the following to the httpd.conf file of your apache server or the .htaccess under the magento root directory magentoHOME/.htaccess

SetEnv MAGE_IS_DEVELOPER_MODE "true"

Open the index.php under the magento root directory. Remove the # at the front of this line

#ini_set('display_errors', 1);

4. Go the admin panel to turn on the template path hint. When this is turned on, every front end page you seeing will show you all the template path for every blocks on the page.

5. Put the below debug statement anywhere in the code, it will print the debug statement to var/log/debug.log

Mage::log("hey, this is a debug statement",
          null,
          'debug.log');

Happy coding and debugging!!! Welcome for more suggestions.

Search within Codexpedia

Custom Search

Search the entire web

Custom Search