Mage::log(print_r($arr, 1), null, 'logfile.log');
Adding a second parameter to print_r will return a string with printed variable.
[EDIT]
based on the comments below I feel obligated to offer other options for logging an array.
Mage::log($arr, null, 'logfile.log');
or if you need a string prefix to the array
Mage::log('prefix'.Zend_Debug::dump($arr, null, false), null, 'logfile.log');
The second parameter of Zend_Debug::dump()
is a label. If this is not null
it will be added to before the array dump.
The third parameter of Zend_Debug::dump()
means echo
. If it's true
then the dump result will be echoed, if it's false
it will be returned as a string. In your case you need it to be false
.