This helped debug some problems I was having with observers not doing what I was expecting.
- Login to your Magento admin and enable logging: Configuration | Developer | Log Settings | Enabled = Yes
- Add Mage::log() statements to your code. For example, in your observer callback: Mage::log(“My special observer called”)
- Watch the log files. In Linux, the tail command is very helpful for this. From the /var/log folder: tail -f system.log exception.log
- Include print_r() output in the log like this: Mage::log(“myvar = ” . print_r($myvar, true))
- Add to the exception.log using Mage::logException()
- The Mage class has some useful helper functions (/app/Mage.php)
- Get the actual class name of any object: $name = get_class($object)
- If you copy and paste this code, you’ll probably need to fix the fancy quotation marks.