11

我在 Prestashop 模块中遇到了以下行:

Logger::addLog('2: md5 string is '.$md5HashData, 1);

日志保存在哪里?

4

1 回答 1

17

日志保存在“日志”表中的数据库中(使用您当前的前缀);

您可以从classes/Logger.php中找到 addLogg 函数

但是没有文档可以从方法注释中找到有用的东西

    /**
* add a log item to the database and send a mail if configured for this $severity
*
* @param string $message the log message
* @param int $severity
* @param int $error_code
* @param string $object_type
* @param int $object_id
* @param boolean $allow_duplicate if set to true, can log several time the same information (not recommended)
* @return boolean true if succeed
*/
public static function addLog($message, $severity = 1, $error_code = null, $object_type = null, $object_id = null, $allow_duplicate = false)

正如我从代码中了解到的,如果第二个参数小于 5(“配置”表中 PS_LOGS_BY_EMAIL 的值),您还应该收到带有警报消息的电子邮件。但它只会被发送和记录一次(如果方法的最后一个参数 $allow_duplicate 不是真的)

注意:这在 Prestashop 1.6 中已更改,该类现在称为PrestaShopLogger,请PrestaShopLogger::addLog($message, $severity);改用。它们显示在后台的Advanced Settings > Logs.

于 2013-04-22T02:46:12.013 回答