Saturday, September 17, 2011

How to Writing Custom Log Message in Magento

To be able to write your custom log message, you have to enable logging from Magento Admin.

To enable logging, go to

Admin Panel -> System -> Configuration -> Developer -> Log Settings -> Enabled = Yes

Then in your code, you can write the following:

Mage::log(“Your Log Message”);

You can check it at var/log/system.log or, var/log/exception.log

If you want to create your own log file for your log message, then you can do it this way:

Mage::log(“Your Log Message”, null, “your_log_file.log”);

Your log file will be created at var/log folder with your log message.

0 comments:

Post a Comment