8

I am trying to add a menu entry in the navigation, but this is causing the navigation menu to disappear, I am trying to debug the code but could not find any particular file.

I have checked the following:

  • Browser's Javascript Console
  • CiviCRM logs from ConfigAndLog folder
  • Apache2 log

Is there anything else I should check? Is there any way I can print the data in the extension_civicrm_navigationMenu(&$params) function?

1 Answer 1

8

(Update) As of v4.7.0, the approaches below still work, but there's a better way to write to the log file using a PSR-3 logger, e.g.:

Civi::log()->info('Hello, log!');
Civi::log()->error('I'm sorry, {name}. I'm afraid I can't do that.', array(
  'name' => 'Stanley Kubrick',
));

See also: https://civicrm.org/blog/totten/the-static-is-dead-long-live-the-static


To write out to CiviCRM's ConfigAndLog folder, one can use either:

CRM_Core_Error::debug_log_message('hello log');
CRM_Core_Error::debug_var('name', $var);

There's also an experimental PSR-3 logger (CRM_Utils_SystemLogger) which writes out to the database (table civicrm_system_log), e.g.

$log = new CRM_Utils_SystemLogger();
$log->info("hello log");
$log->error("I'm sorry, {name}. I'm afraid I can't do that.", array(
  'name' => 'Stanley Kubrick',
));

If the debug statement is temporary (won't be committed/redistributed), then you can usually use CMS-specific functions (like Drupal devel's dpm() or Joomla's JLog).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.