Wednesday, March 15, 2017

ELASTICSEARCH: Restarting Elastic Search SugarCRM Installation

Error:
Unable to connect to Full Text Search server, please verify settings

Solution:
1. Check ElasticSearch is running
   >  sudo /etc/init.d/elasticsearch status
2. If status is not running, restart
   >  sudo /etc/init.d/elasticsearch restart
3. If the above does not work, modify /etc/elasticsearch/elasticsearch.yml as follows:
discovery.zen.ping.multicast.enabled: false and repeat 1 & 2

Monday, March 6, 2017

SUGARCRM: Debugging SugarCRM 7.x

Inside a Logic Hook or any other backend file:

echo "<pre> DEBUGGING: ".PRINT_R('BEFORE' ,TRUE)."</pre>";

NOTE: The above command is for debugging purposes only. Make sure to remove that command before pushing to either production or QA.

UNIX: Checking Logs in Real-Time

$>> tail -f <filename>

SUGARCRM: 500 Error when using $GLOBAL['log']->fatal()

Error: HTTP Error: 500 when saving a record.

Code:  Logic hook makes a SOAP call, and then we display the result as follows:
$GLOBALS['log']->fatal('>>>>>' . $response, true); // ERROR HERE


Solution:
$response is returning a JSON object, so we need to escape the result as follows:
$GLOBALS['log']->fatal('>>>>>' . print_r($response, true));