57

I am new to Magento. I can't find log files in Magento. I googled it, but the Magento Commerce site returns closed and some other sites explain how to create custom log files. I want to know the location of built-in log files.

1
  • 1
    var/log folder on root..system.log and exception.log are the default ones
    – huzefam
    Jun 13, 2014 at 11:25

4 Answers 4

79

You can find them in /var/log within your root Magento installation

There will usually be two files by default, exception.log and system.log.

If the directories or files don't exist, create them and give them the correct permissions, then enable logging within Magento by going to System > Configuration > Developer > Log Settings > Enabled = Yes

4
  • 2
    no need to create directories..magento creates them at runtime if not found
    – huzefam
    Jun 13, 2014 at 11:27
  • 2
    In a recent install of Magento 1.9, this wasn't the case for me and I had to manually create the directories.
    – Karl
    Jun 13, 2014 at 11:33
  • exception.log and system.log are name of the file. What should the name of the directories be? Apr 25, 2016 at 5:21
  • Both files should be within /var/log/, e.g. /var/log/exception.log
    – Karl
    Apr 25, 2016 at 11:30
5

To create your custom log file, try this code

Mage::log('your debug message', null, 'yourlog_filename.log');

Refer this Answer

2
  • Sir can you please tell me how to create a exception.log file in magento. I can see system.log file but there is no exception.log file Jun 25, 2015 at 6:19
  • No need to create that file, it will automatically create that file when a exception occurs. If you need to create that file, you can change the file name in 'yourlog.log' in the above code Jun 25, 2015 at 6:22
0

You can find the log within you Magento root directory under

var/log

there are two types of log files system.log and exception.log

you need to give the correct permission to var folder, then enable logging from your Magento admin by going to

System > Configuration> Developer > Log Settings > Enable = Yes

system.log is used for general debugging and catches almost all log entries from Magento, including warning, debug and errors messages from both native and custom modules.

exception.log is reserved for exceptions only, for example when you are using try-catch statement.

To output to either the default system.log or the exception.log see the following code examples:

Mage::log('My log entry');
Mage::log('My log message: '.$myVariable);
Mage::log($myArray);
Mage::log($myObject);
Mage::logException($e);

You can create your own log file for more debugging

Mage::log('My log entry', null, 'mylogfile.log');
0

These code lines can help you quickly enable log setting in your magento site.

INSERT INTO `core_config_data` (`config_id`, `scope`, `scope_id`, `path`, `value`) VALUES
('', 'default', 0, 'dev/log/active', '1'),
('', 'default', 0, 'dev/log/file', 'system.log'),
('', 'default', 0, 'dev/log/exception_file', 'exception.log');

Then you can see them inside the folder: /var/log under root installation.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.