Create your own Magento log files with Mage::log()

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);

Continue Reading

Enable system error and exception logging in Magento

By default, Magento does not register messages about errors and exceptions; so if something bad happens, you don’t even know.
To turn on the logging, you can navigate to System > Configuration > Developer > Log Settings and set the «Enabled» option to «Yes»
Don’t forget to set full access permissions (777) to the following folder: /var/log, since that is the place where those log files are stored.

Get the current category name in Magento

A key part of the request execution has information stored into the Mage registry and accessing this information is a simple call requesting the needed data.  Learn how to access the registry to find the current category title.

The registry object we are interested in is ‘current_category’ and we will utilise the registry call getName() to create call to retrieve the needed information thusly;

Mage::registry('current_category')->getName();