I have written debug() in a php file in my local Drupal project. I am trying to see the output. How do I do that?

  • where exactly you located the php file that contain debug() function?
    – Aboodred1
    Oct 29, 2014 at 22:01

1 Answer 1


The output should be logged to the Drupal watchdog (admin/reports/dblog). If you're debugging a variable that is an array or object, don't forget to pass TRUE as the third parameter (ref).

Although the code in question may be in a function cached by Drupal, so sometimes you need to flush the cache to trigger that code to be re-run.

Personally, I prefer using the dpm() function from the devel module for debugging. If using an account with admin permissions, it displays arrays/objects in a way that is easier to inspect.

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.