Engine23

Magento - write to a log file

Magento has a built in feature to write to a log file. In your code, you can use Mage::log(''). In the quotes, you can put in anything you want, in my example, i am adding some text and then the dynamic customer email address. Mage::log('Email sent to ' . $customer_email); This should end up in the /var/log/system.log Viewing that file, via command line, you can use: $ tail /var/log/system.log and that will show you the last 10 results. Make sure you remove this at some point or that log file will continue to grow and grow

Share: