0

On Magento I have tried

   Mage::log ($order);

I suppose to get the array printed on my

   var/log/system.log

But instead the website does not load again, after few min it comes as timed out.

6
  • 2
    You are doing it right. The problem is that and order object is huge because of the references to other objects and is not a good idea to print it. Print only the data you need. Commented Apr 16, 2014 at 14:11
  • I am not sure what data are available in the array unless I print it. Could you please give me an example.. Commented Apr 16, 2014 at 14:18
  • Try printing this: Mage::log(array_keys($order->getData())). This should print you a simple array with keys of the order model instance. Then pick your key and just log this Mage::log($order->getData($key)). Commented Apr 16, 2014 at 14:41
  • Have you tried to use debugger? Commented Apr 16, 2014 at 15:08
  • I'm new to Magento, How do I use debugger ? Commented Apr 16, 2014 at 16:09

3 Answers 3

1

try this

Mage::log($order->toArray());
Sign up to request clarification or add additional context in comments.

2 Comments

Mage::log(print_r($order, true));
Tried Mage::log($order->toArray()); and Mage::log(print_r($order, true)); Non worked .. . :(
1

Following print the entire array in to MyArray.log

   Mage::log("Query product: ".print_r($order->debug(), true),null,'MyArray.log');

MyArray.log can be found in

   var/log/MyArray.log

The following Prints the array Keys

   Mage::log(array_keys($order->getData()));

Comments

1

Try that: Zend_Debug::dump($your_variable);

And this is one of the best posts about that in my opinion: MAGENTO DEBUGGING HINTS

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.