Debugging Magento

Configuration tweaks to debug your Magento development environment.
created by on 2013-02-07

Enable Exception Reporting

Magento does not display exceptions by default. To enable exception printing in Magento you only have rename the file “errors/local.xml.sample” file in your Magento folder to
“errors/local.xml”.

cd /<Magento-htdocs-folder>/errors
mv local.xml.sample local.xml

Screenshot of the local.xml and local.xml.sample file in Magentos errors folder

Links:

Enable Logging

Goto "Magento Admin Panel" > System > Configuration > Advanced > Log Settings and set the log setting “Enabled” to “Yes”.

Screenshot of the Mangeto Log Settings in the Admin Panel

Once you have enabled logging you will find an exception and a system log in your <Magento-htdocs-folder>/var/log folder.

tail -f <Magento-htdocs-folder>/var/log/system.log

Screenshot of the Magento system.log

Set the PHP Error Reporting Level and make sure errors are displayed

Make sure your PHP error reporting level is set to E_ALL in your index.php - this will make sure no errors are swollowed by the system.

error_reporting(E_ALL);

Screenshot of the error_reporting command in Magento's index.php

And also that the PHP’s display_errors flag is set to true:

ini_set('display_errors', 1);

Screenshot of the display_errors command in Magento's index.php

Enable Magentos Developer Mode

When you turn on Magento’s developer mode you will get more detailed error messages and stack traces.

Enable Developer Mode in your .htaccess:

SetEnv MAGE_IS_DEVELOPER_MODE "true"

Screenshot of an .htaccess file in which the Magento Developer mode is enabled

Links

Tags:
Fork allmark on GitHub