Drupal – Debug Output not Displaying?

Have you ever noticed that sometimes no debug output whatsoever appears when you call a debug output function like dprint_r() from the PHP code that you’re working on?  For example, if you call one of the debug dump functions from the default argument handler for a block view (see earlier post) you won’t see a blessed thing! It seems that there are plenty of situations in the drupal processing lifecycle where output debug information will not get through for display on a page…

 

So what’s to be done? life without debug information can get very difficult and frustrating, but not to worry as in these difficult cases we can always log our debug info to a file using file_put_contents() (as suggested here), for example if you wanted to dump information about a variable called $my_variable you could call:

[code lang="php"]
file_put_contents("./drupal.debug",
                 print_r($my_variable, TRUE),
                 FILE_APPEND);
[/code]

Then simply read the contents of the file drupal.debug, not pretty and not perfect but a whole lot better than nothing!

1 reply

Trackbacks & Pingbacks

  1. […] Read more: Drupal – Debug Output not Displaying? […]

Comments are closed.