Magento comes with a built-in logging facility which can be enabled and configured in the back-end under System > Configuration > Developer. Alternatively you can enable the Developer Mode for the site to enable the log (on how to do this have a look at the index.php file). The exception log is always on.
Mage::log('My log entry'); Mage::log('My log message: '.$myVariable); Mage::log($myArray); Mage::log($myObject); Mage::logException($e);