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();
http://stackoverflow.com/questions/12084772/magento-api-logs