Debugging Notes

Events happening in the community are now at Drupal community events on www.drupal.org.
yurtboy's picture

We talked about ways to debug. I noticed this in the Drupal Pro Development Book (http://www.apress.com/book/view/1590597559)
They use the php debug block to pass debug code.
----------------excerp--------------
pg 521-522
Other Uses for the devel Module
The devel module has other handy functions tucked away to increase your development
acumen.
For example, you can switch the user that Drupal perceives is viewing the page in real
time. This is useful for technical support and debugging other roles. To switch to another user,
navigate to the URL http://example.com/?q=devel/switch/$uid, where $uid is the ID of the
user you want to switch to. Alternatively, enable the “Switch user” block, which provides a set
of links to do the same.

CHAPTER 21 s DEVELOPMENT BEST PRACTICES
The devel module provides an additional block called Execute PHP that can be handy for
entering and executing short snippets (and provides yet another reason for making sure the
devel module is disabled on your production site!).
You can print out debug messages that are hidden from other users with the dpm(), dvm(),
dpr(), and dvr() functions:
• dpm() prints a simple variable (e.g., a string or an integer) to the message area of the
page. Think of it as meaning “debug print message.”
• dvm() prints a var_dump() to the message area of the page. Use this for complex vari-
ables such as arrays or objects. Think of it as meaning “debug variable message.”
• dpr() prints a complex variable (e.g., an array or object) at the top of a page using a
special recursive function (dprint_r()) that gives nicely formatted output.
• dvr() prints a nicely formatted var_dump() to the top of the page.
The output of all of these functions is hidden from users who do not have “access devel
information” permission, which comes in handy for real-time debugging.
An example usage follows:
dpr(node_load(5)); // Display the data structure of node 5.
dvr($user); // Display the $user variable.

Comments

firebug for firefox has a drupal debug plugin

Western Massachusetts

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: