Print array contents in log file of magento

In Magento You can print your log in Exception.log using
If you want to put the log to your custom log file, then you can use write below line
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
Mage::getModel('core/log_adapter', 'custom.log')->log($arrayvariable);
Mage::log('Your Data :'.print_r($arrayvariable, true), Zend_Log::DEBUG, 'custom.log');

No comments:

Post a Comment