How to debug magento application

30,753

Solution 1

It sounds like you want to enable Developer mode. Add this to your .htaccess file:

SetEnv MAGE_IS_DEVELOPER_MODE "true"

You may also want to enable display errors in index.php:

 ini_set('display_errors', 1);

The best way I have found to debug is with X-Debug in a local environment. You can also use log files to help debug in a production environment, if your unable to run X-Debug in the environment.

I've got a more detailed posting here:

Consider also installing XDebug

Solution 2

This thread is old but useful. Debugging tools and tricks are important as it saves lots of time of a developer.

Here is a compiled list My company Uses.

  1. Use of Eclipse debugger: Magento is installed on a desktop using Eclipse debugger we apply breakpoints and other debugging tricks.

  2. Use of Bug commerce as suggested in above post.

  3. Use of Mage::log for error log and exception log.Also Magento Report files.

  4. Use of Varien Object getData, debug.

  5. Use of back trace: Mage::log(Varien_Debug::backtrace(true, true), null, 'backtrace.log')

  6. Remote server level debugging.

  7. var_dump PHP function to echo and exit.

Solution 3

If you are (want to be) a real Magento Developer, here is the best combination of IDE and plugin you must use to work on your Magento Projects.

  1. First of all, phpStorm the best IDE you can find.
  2. Exist a very helpful plugin called magicento that you can use auto-complete, find in path magento, create modules very quickly and without issue, other great stuff you can use with that plugin.
  3. Of course need to install Xdebug (be carefully if you already run a project with ioncube, bc you need to make some trick there, Xdebug doens't work properly with ioncube loader).
  4. This last item on the list is something I need to be reviewing but I think should be great to debugging porpoises, MagentoDebugger Chrome App.

Let me know if you need something else or any help installing some of the stuff.

Best, Alejandro.

Solution 4

You can look in var/log/exception.log or system.log in the magento root. These are the directories for Magento excepetions and logs. Otherwise you might need to increase the php error log level.

Alan Storm created a Commerce Bug to help with some inline development issues.

Share:
30,753
Sebastien
Author by

Sebastien

I am a freelancer working on your projects using this stacks : - Magento 1 & 2 - Angular js 1&2 - Ruby on rails I made this websites : https://www.digimage.fr (Magento 2) http://www.johngalliano.fr (Magento 2) http://www.paycar.fr (Ruby on rails) I work with customer of any size, improve an existing project or create a product for a startup. You can find all my work on my website : http://www.sebfie.com

Updated on August 02, 2020

Comments

  • Sebastien
    Sebastien almost 4 years

    I am working with Magento but i didn't find a very good way to debug my modules. For example, many time, i got a blank page with no php error and no apache error. For example, in backend, if one grid controller isn't well set, i don't have an error.

    How to debug Magento module?

  • Jürgen Thelen
    Jürgen Thelen almost 13 years
    Afaik Magento uses error_reporting(E_ALL | E_STRICT) by default. How should that be increased any further?
  • RNickMcCandless
    RNickMcCandless over 10 years
    I second that Commerce Bug for Magento is a great tool. It's $50 but well worth every penny since it takes all of the guess work out!
  • Gem
    Gem over 6 years
    For Production site error solving, How can i do, the error is display only on my system using My IP Address, how can i do that?
  • B00MER
    B00MER over 6 years
    @Rathinam Typically you would want to refrain from setting to developer mode without the IP exception to avoid heavy disk I/O when logging or using xdebug remotely for instance. With that said: docs.magento.com/m1/ce/user_guide/configuration/advanced/… has your answer. index.php can be wrapped up as well with the same conditioning but will require caching disabled during an off peak time & consider maintenance mode with IP testing with punched similarly to: * gist.github.com/molotovbliss/16a36c803f3f01cf22359d0d58b80c4‌​4
  • myshadowself
    myshadowself over 4 years
    This link redirects through random sponsored URLs. AVOID.