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.

Rich Bianco
  • 4,141
  • 3
  • 29
  • 48
IamGhale
  • 1,275
  • 2
  • 14
  • 26

4 Answers4

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

Karl
  • 5,435
  • 11
  • 44
  • 70
5

To create your custom log file, try this code

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

Refer this Answer

Saravanan DS
  • 278
  • 3
  • 14
MeenakshiSundaram R
  • 2,837
  • 3
  • 29
  • 41
  • 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 – Shantanu Nandan Jun 25 '15 at 06: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 – MeenakshiSundaram R Jun 25 '15 at 06: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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
phanvugiap
  • 336
  • 3
  • 8