Wednesday , December 19 2018
Home >> All tutorial >> Print array contents in log file of magento

Print array contents in log file of magento

In Magento You can print your log in Exception.log using

  1. Mage::logException($e->getMessage());

If you want to put the log to your custom log file, then you can use write below line

  1. Mage::log(‘Your Query’, Zend_Log::DEBUG, custom.log);

But the problem is that , It will not print any Array data, If you want to print Array data in to log file then you can use any one of the below method:

  1. Mage::getModel(‘core/log_adapter’, ‘custom.log’)->log($arrayvariable);
  2. or
  3. Mage::log(‘Your Data :’.print_r($arrayvariable, true), Zend_Log::DEBUG, ‘custom.log’);


Here is the library of Magento Download for FREE (all versions)

Your Magento website needs a powerful Magento ERP for stock control.


magento erp

About Champ

Leave a Reply

Your email address will not be published. Required fields are marked *

Heap | Mobile and Web Analytics