Reputation: 1800
Is there any way to turn on logging for API calls?
We have a third party application that is having trouble working with our store and would like to get some debuggging info. ~I have searched bt found nothing.
I'm using 1.7
Upvotes: 6
Views: 11331
Reputation: 558
for a controlled period of time you can manipulate your index.php like so:
put this code at the end of the index.php around the ::run call:
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();
its quick and dirty but for adhoc debugging it works
Upvotes: 9
Reputation: 7730
A really good solution is to use an API proxy. It's not as complex as it sounds. It's just a PHP script you point your API calls to instead of the the normal API URL. The idea is that it logs every incoming API request before passing it onto the normal magento API. It also logs the responses before passing it back to the client.
There's a ready built one right here which I've used in the past to diagnose many API issues. http://techcolin.net/2011/11/a-php-proxy-script-for-logging-magento-api-soap-calls/
Upvotes: 1
Reputation: 12737
If you mean some simple backend setting simliar to
System -> Configuration -> Developer -> Debug -> Profiler -> Yes
by this, then no, there's no such feature in Magento OOB.
I'd suggest to use a PHP debugger and single step thru the API call the 3rd party app calls.
Or temporarily insert Mage::log()
calls along side that API call, logging data of interest, so that you can check var/system.log
for what's going wrong.
Upvotes: 0