Magento create custom log file

Magento create custom log file : Magento provide to create logs functionality. Default logs are stored in system.log file which is created in folder var/log/ststem.log. Magento’s defualt warnings and error messages are stored in the same file. We are going to explain the both default and custom error log messages. You can create log in magento simply as below :

Magento create custom log file Example

Magento Create Custom log file Example

Mage::log('Your Error Message here.....', null, 'logfilename.log');

The log method accepts three parameters as input parameter to create custom log file. First parameter is message to be logged, second parameter is null and third is file name you want to create and log the message. This file will be create in the same folder system.log file exists.

Note : This file will be created in folder “var/log”.

Magento Default Log File – system.log

Let’s have look over magento default logging file system.log. All the logs created by system are stored in this file.

Magento Create Log in – system.log

Here is simple syntax you can use to create your log in system.log file-

Magento system.log file Example

Mage::log('Your Data here....');

This will append the above message in magento system.log file.

Tip : If you working with system exceptions logging, prefer to create logs in system.log file.


Add Comment

📖 Read More