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.
4 Answers
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
-
2no need to create directories..magento creates them at runtime if not found– huzefamJun 13, 2014 at 11:27
-
2In a recent install of Magento 1.9, this wasn't the case for me and I had to manually create the directories.– KarlJun 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
-
To create your custom log file, try this code
Mage::log('your debug message', null, 'yourlog_filename.log');
Refer this Answer
-
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
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');
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.