Magento Debugging

Debugging is the process of identifying and removing number of bugs/errors from code. Development in Magento without debugging can be challenging for developer. As a development organization, oscprofessionals provides some useful information and tips about debugging for Magento users.

Debugging Magento is as follows:

Debugging Tips

  • Zend_Debug::debug() OR var_dump($data); OR print_r($data);
    There will be times that simply dumping data to the screen can be cause browser hangup. We always use the getData() method that Magento has built in to the varien object.
  • Reseting Password through the Database
  • Log Files: Magento Log system is very useful.
    How to turn on log system ?
    • In the goto Admin → System → Configuration → Developer
    • Select the Log Settings tab and select “Enabled = Yes”
    • eg. How to used Mage::log($data,null,”data.log”);
      You can specify your own log file, log file will appear in /var/log/data.log

  • How to display PHP errors? How to turn them on?
    For development use only, do not do this on a production site.
    Change Mage::setIsDeveloperMode(true); in index.php
    ini_set(‘display_errors’, 1);
  • Use of Eclipse debugger: Magento is installed on a desktop using Eclipse debugger. We apply breakpoints and other debugging tricks.
  • Use of Varien Object getData, debug.
  • Use of back trace: Mage::log(Varien_Debug::backtrace(true, true), null, ‘backtrace.log’);
  • Remote server level debugging.
  • var_dump PHP function to echo and exit.
  • Use of Mage::log for error log and exception log. Also Magento report files.