B-219 Sec-55 Noida, India

Magento Create Own Log files

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.

Magento Comes with a built-in Logging Facility Which can be enabled and configured

1. Enable developer mode in the .htaccess file by adding:

2. Enable log settings going to:
System » Configuration » Developer, Log settings tab » Enabled » Yes.

Mage::log(‘My log entry’);

Mage::log(‘My log message: ‘.$myVariable);




By default all log entries are appended to the var/log/system.log file and the exceptions are logged to var/log/exception.log.

For Example

Looking at the method definition in app/code/Mage.php you will find
public static function log($message, $level = null, $file = ”) {}

so if you want to create own log that can be done by
Mage::log(‘My log entry’, null, ‘mylogfile.log’);

and will all our log entries are in their own file at var/log/mylogfile.log. Exceptions can only be logged to one file

(Visited 73 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.