rss
twitter
    Find out what I'm doing, Follow Me :)

Friday, December 18, 2009

Pin It

Widgets

Magento Quick debugging tip

You can add items to magento’s system log and exception log in your code. This is very handy for pin-pointing coding errors / problems. Developing for Magento is often hard, especially since it’s not always possibly to have error reporting on (and even when it is on, its hard to find exactly what’s wrong!).

Here’s an example of it’s use:

1) Turn on your logging: Admin > Configuration > Developer > Log Settings > Enabled = Yes

2) Example code snippet where you might find this useful:

<?php
$response = curl_exec($ch);
//just an example of something - might use this in a custom payment or shipping module

Mage::log($responseBody);
?>

3) Watch your var/log/system.log and var/log/exception.log for raw information from this.

You may run into file permission errors, so you might need to set your folder permissions appropriately

Source : http://www.exploremagento.com/

No comments:

Post a Comment