Search code examples
rubyruby-2.1

Is it possible to extract locals and their values from a stack trace in Ruby?


I'm investigating a crash in my Ruby application. The stack trace in my log isn't enough information, and I cannot reproduce the error. When an unhandled exception occurs, I need to log the values of the locals in the frame where the exception occurred.

Is there any way to do that in Ruby?


Solution

  • It is not easy to do it yourself, but there is a gem binding_of_caller (gem) written by banisterfiend that makes it possible.