Hello everyone !
I'm stuck about a little question, and i'm sure you'll be able to answer it :
How can i write in sugarcrm.log (using $GLOBALS['log']->logLevel(msg) ) while i'm in a cutom API?
What i have & what i want :
I've created a custom API for Leads module, which performs a soapCall to an external Soap WebService.
My customer would like to see some steps performed during the soapCall like
"Initialization", "SoapCall performed"/"SoapError!", "SoapCall successful" ...
What i tried :
In custom/modules/Leads/clients/base/api/soapCallApi.php, i've wrote :
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class soapCallApi extends SugarApi
public function registerApiRest()
'leadToPerson' => array(
'reqType' => 'GET',
'path' => array('leadToPerson','callPrima', '?'),
'pathVars' => array('', '', 'data'),
'method' => 'callPrima',
'shortHelp' => 'A soap Call to Prima',
'longHelp' => '',
public function callPrima($api, $args)
global $current_user;global $db;global $beanFiles;
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
$GLOBALS['log']->fatal("Script for SoapCall began");
[... all my script]
But it gives me nothing, even if the logs are set to "debug". And later, in my script, if i try any $GLOBALS['log']->fatal("Here is my variable : ".$myVariable); or even $GLOBALS['log']->fatal("Here is my variable : $myVariable"); i get a Server 500 Error...
Do you have any idea on how i could add some entries to sugarcrm.log when i'm on my custom Api script ?
Thanks a lot for yout precious time and your knowledges!