Magento Tip: Debugging and development using log files

Just a short sweet tip that will be essential as soon as you dive into any sort of debugging or development with Magento. Enable logging in the admin then use the static method log() to record information.

Enable logging in the admin:

Menu > System > Configuration > Advanced > Developer > Log Settings

Set “Enabled” to “Yes” and set the filename to whatever you want.
The log file will be written to the var/log/ directory.

Use Magento’s static method log() in your code:

Mage::log('hello');

Watch the logs:

tail -f var/log/system.log

Note: remember to disable loggging when you’re done so the log files don’t grow out of control.

Leave a Reply