Magento: write to log file

Go to Admin > System > Configuration > Developer > Log Settings
Change the value to YES for Enabled field.

Use the below code to write to log:

Mage::log("Success");

Log can be viewed at var/log/system.log or var/log/exception.log

To write to a custom log file. Use the below code:

Mage::log("This is a log", null, custom.log);

The file custom.log will be added to the folder var/log/

Advertisements
Magento: write to log file

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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