Magento debug log and troubleshooting tips

Taking steps to get started with Magento development and debug your Magento module

1. One of the most difficult task in magento is to locate a particular file in recursive folders. Magento provides a setting in the admin panel to find the template files.

To locate any template file location. Enable the template path hints.

After enabling the template path hints you can visit the frontend and view the path of template file.



2. Another Important setting available in magento is the error logging feature. It saves the custom log messages and exceptions thrown in the system.

Instead of throwing the error messages in the screen the error logging feature saves the error messages in a text file.

3. In the index.php file uncomment below options
ini_set(‘display_errors’, 1); -> enable PHP error  logging for all warning / notice / error
Mage::setIsDeveloperMode(true); -> Enable developer mode for Magento store
Varien_Profiler::enable(); -> Enable all database query log and profiler information

A few ways to print out specific query
echo $this->getSelect();

4. Using Debug Extensions to extend debug information
Magento Layout Manual
Magento Debug Toolbar

5. Sometime you need to trace and see how your function is called. You may need to display call stack. However displaying debug trace in Magento is a headache because Magento hold very large object data which is impossible to print out the screen. The idea is unset unnecessary data to display call stack only. Here is code

$temp = debug_backtrace();
foreach ($temp as $k => $t) {

Leave a Reply

Your email address will not be published.

4 × 5 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>