I'm desperately trying to debug some problems I'm having with creating an manipulation of nodes in drupal 7 Services 3.

I've tried to insert a few debug statements to figure out where things are going wrong. When I create a node using poster (from the browser) it worked great, it prints the info I want.

When I do it from my app (iphone app), the same function is called, but the debug does not seem to print out to the page, even if I refresh it. I wonder what I am doing wrong.


2 Answers 2


Standard debugging functions like dpm() and dvm() use the drupal_set_message() function, which is tied to a user's session. When you try using the node form, you see the message because it is saved to your session. However, when you use the service via your iphone app, the messages get saved to a session that is probably not the one you're logged in under.

Fortunately, for situations like this, you can use the dd() function, which will print the debugging information out to a file in the /tmp directory, typically called drupal_debug.txt.

[edit] I notice you're using the debug() function, which triggers error handling, note that this also uses drupal_set_message(), so the above is still relevant. (The dpm() and dvm() functions are from the Devel module.)

  • this is exactly what I need thanks, fyi on my system the file ends up in Applications/MAMP/tmp/php
    – user379468
    Nov 15, 2011 at 1:04

You could also try using watchdog().

watchdog('debug', '<pre>'. print_r($example_array, TRUE) .'</pre>');

Your Answer

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

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