To write information to your own custom log file, say to trace errors in a custom module, track odd behaviour or record that a certain event has happened, you use Mage::log()
Mage::log(‘<WHAT TO WRITE IN THE LOG>’, null, ‘FILENAME.log’, true);
If you want to log the output of an array, use print_r but with the second parameter set to true – this converts the output to a string.
e.g. Mage::log(print_r($myArray,true), null, ‘FILENAME.log’, true);
I hope this is helpful. If it has and has saved you some time, feel free to buy me a beer.