Knowledgebase
Possible ways to debug AITOC’s extensions.
Posted by Denis Krupkov on 08 February 2013 03:02 PM

There are two common ways to debug Magento and extensions.
The first way is simple and convenient for targeted debug when it’s known where to debug. This is also convenient when server configuration is inaccessible and there is no way to turn on Xdebug. Just add the line as follows at the needed position:

Mage::log(‘Some message or data here’, false, ‘my_file_name.log’, true);
Then after the launch of Magento the my_file_name.log file should appear under /var/log directory. Note that prior to Magento v.1.4.1 it’s necessary to enable logging in Magento backend at System -> Configuration -> Advanced -> Developer -> Log Settings -> Enabled.

The second way is to use some debugging tool like Xdebug. This way is convenient when some advanced debugging is needed. It’s possible to see line by line how exactly system works including stack, values of variables etc. This way requires some additional preparations: debugging tool should be installed and configured on the server; IDE editor should be installed and configured on developer’s machine, some browser plug-in may be required by certain debugging tool. We recommend to use Xdebug tool as it’s easy to configure and use it. Additional info about Xdebug could be found here: http://xdebug.org/ . Note that while using debugging tool it’s too time-consuming to debug the whole Magento – it’s much more effective to place some breakpoints in places of interest and debug from them (at certain class or template in example).

Here is some advice on debugging of our extensions. First of all it’s necessary to disable all types of cache in System -> Cache Management section of Magento backend. Generally the debugging process is the same as for clean Magento except a couple of things:

Rewrites should be debugged using Mage::log() in original files under /app/code/local/[Aitoc|AdjustWare]/ModuleName/Rewrite/[some class here] or under /var/ait_rewrites/ if some tool like Xdebug is in use.

Patched templates should be debugged at /var/ait_patches in both ways except the case when patched files are customized and placed under /app/design/[area]/[package]/[theme]/aitcommonfiles .

(51 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako Resolve