Magento Logging

While working in magento, sometimes we required to debug some content or variable.

So now to fulfill our requirement with debugging, we can use magento’s system and exception logs.

Where exception log file contains the log of exception, and we can write any content or variable in system log file.

But by default system and exception both logs are disabled in magento.

We can enable them from Admin -> System -> Configuration -> Developer -> Log Settings -> Enable.

The log files for both system and exception stores in {{base_dir}}/var/log.

To do system log we have to use “Mage::log()” and to do exception log we have to use “Mage::logException()”.

For Example:

Mage::log(“Test System Log1”);
Mage::log(“Test System Log2”,  null, “mylogfile.log”);
Mage::logException(“Test Exception log”);

Hope this will help you.

Posted in Magento. 1 Comment »

One Response to “Magento Logging”

  1. Dennis Roberson Says:

    Hey that was really needful. Thanks for sharing. I’ll surely be looking for more.

Speak Your Mind

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: