I want to log the current backtrace (stacktrace) in a Rails 3 app without an exception occurring. Any idea how?
Why do I want this? I\'m trying to trace the
You can use Kernel#caller:
# /tmp/caller.rb def foo puts caller # Kernel#caller returns an array of strings end def bar foo end def baz bar end baz
Output:
caller.rb:8:in `bar' caller.rb:12:in `baz' caller.rb:15:in `'