Magento API日志

Mat*_*man 6 magento

有没有办法打开API调用的日志记录?

我们有第三方应用程序在使用我们的商店时遇到问题,并希望得到一些调试信息.〜我搜索过什么都没找到.

我正在使用1.7

gre*_*e83 9

在一段受控的时间内你可以像这样操纵你的index.php:

将此代码放在:: run调用的index.php末尾:

ob_start();
Mage::run($mageRunCode, $mageRunType);

if(preg_match('/api/', $_SERVER['REQUEST_URI'])) {
        Mage::log('<<< request '.$_SERVER['REQUEST_METHOD'].': '.$_SERVER['REQUEST_URI'], null, 'api.log');
        if($_SERVER['REQUEST_METHOD'] == 'POST') {
                Mage::log('<<< '.file_get_contents('php://input'), null, 'api.log');
        }
        Mage::log('>>> '.ob_get_contents(), null, 'api.log');
}

ob_end_flush();
Run Code Online (Sandbox Code Playgroud)

它的快速和脏,但对于特殊的调试,它的工作原理


Jür*_*len 0

如果你的意思是一些简单的后端设置类似于

System -> Configuration -> Developer -> Debug -> Profiler -> Yes 
Run Code Online (Sandbox Code Playgroud)

那么不,Magento OOB 中没有这样的功能。

我建议使用 PHP 调试器并单步执行第 3 方应用程序调用的 API 调用。

或者Mage::log()在 API 调用旁边临时插入调用,记录感兴趣的数据,以便您可以检查var/system.log出了什么问题。