Where are Magento's log files located?

前端 未结 3 1042
陌清茗
陌清茗 2021-01-31 01:34

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.

相关标签:
3条回答
  • 2021-01-31 02:12

    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 讨论(0)
  • 2021-01-31 02:15

    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

    0 讨论(0)
  • 2021-01-31 02:31

    To create your custom log file, try this code

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

    Refer this Answer

    0 讨论(0)
提交回复
热议问题