Skip to Main Content
Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working
book

Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working

by Philippe Hanrigou
October 2007
Intermediate to advanced content levelIntermediate to advanced
58 pages
59m
English
Addison-Wesley Professional
Content preview from Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working

Section #2. Ruby Troubleshooting: The Usual Suspects

Even though strace, lsof, and friends are powerful tools, most of the time you should not start with them. This section is a brief recap of the techniques typically used to troubleshoot a problem with a Ruby process.

raise, puts, and debug()

Without a doubt, the most popular way to investigate an unexpected behavior in a Ruby program is to add a raise some_object.inspect statement or a puts some_object.inspect statement in the code and rerun the same test or use case. Quick and dirty...and terribly efficient (especially the raise version: It is easy to spot, and you won’t forget to remove it).

Rails has a variant for HTML rendering in a view: the debug() function. This function outputs the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ruby Closures

Mastering Ruby Closures

Benjamin Tan Wei Hao

Publisher Resources

ISBN: 9780321544681