Home Magento Guide

Quick debugging tip

12 September 2009 No Comment

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

By Fido from exploremagento.com

Related posts:

  1. Some custom Blocks to help you show products
  2. Custom checkout cart – How to send email after successful checkout
  3. NaviGate by MerchantPlus in Magento
  4. Access denied in Magento admin
  5. How to use WordPress home page in Magento home page (CMS page)

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

Security Code: