php Magento 的日志文件在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24203700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:12:53  来源:igfitidea点击:

Where are Magento's log files located?

phpmagentoerror-log

提问by IamGhale

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

我是 Magento 的新手。我在 Magento 中找不到日志文件。我用谷歌搜索,但Magento Commerce站点返回关闭,其他一些站点解释了如何创建自定义日志文件。我想知道内置日志文件的位置。

回答by Karl

You can find them in /var/logwithin your root Magento installation

您可以/var/log在根 Magento 安装中找到它们

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

默认情况下通常会有两个文件,exception.logsystem.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

如果目录或文件不存在,请创建它们并赋予它们正确的权限,然后通过转到在 Magento 中启用日志记录 System > Configuration > Developer > Log Settings > Enabled = Yes

回答by MeenakshiSundaram R

To create your custom log file, try this code

要创建自定义日志文件,请尝试使用此代码

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

Refer this Answer

参考这个答案

回答by Jitendra Kumar

You can find the log within you Magento root directory under

您可以在 Magento 根目录下找到日志

var/log

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

有两种类型的日志文件 system.log 和 exception.log

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

您需要为 var 文件夹授予正确的权限,然后通过转到从您的 Magento 管理员启用日志记录

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.

system.log 用于一般调试并捕获来自 Magento 的几乎所有日志条目,包括来自本机和自定义模块的警告、调试和错误消息。

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

exception.log 仅保留用于异常,例如当您使用 try-catch 语句时。

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

要输出到默认的 system.log 或 exception.log,请参阅以下代码示例:

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');