Rails/Ruby: Any way to shorten the stack traces?

Go To StackoverFlow.com

5

I would like to limit the size of the stack traces I am seeing in Rails. I'm not really interested in debugging the Rails stack as much as my own application. Is there any built-in way to have Rails do this dynamically?

2009-06-16 18:52
by Dan Rosenstark
So, did john's answer worked fine - marcgg 2009-07-14 18:00
I just started with Rails 2.3, so I'll have to check it now. Please report back if you find that it's cool, marcgg... Thanks - Dan Rosenstark 2009-07-14 18:55


6

Yes. Take a look at the ActiveSupport::BacktraceCleaner class. Nice explanation here.

2009-06-16 19:56
by John Topley
+1 I'll check it out, thanks John - Dan Rosenstark 2009-06-17 00:58
So in 2.3 this will all be automatic, basically, right - Dan Rosenstark 2009-06-17 01:01
Yes, that's right - John Topley 2009-06-17 06:21
looks cool - marcgg 2009-06-17 15:35
Sorry, I haven't marked this best answer because I haven't tried it yet, but I will shortly. Thanks again, John - Dan Rosenstark 2009-07-14 19:00


2

You could wrap the code with your own exception catcher and just output how much you want.

Using the array from the backtrace-Method

Only alternative I could think of. Recompiling Ruby and changing the values which control the stack depth in eval.c (TRACE_HEAD and TRACE_TAIL)

2009-06-16 19:04
by jitter
+1 Actually writing error-catching code?! Yeah, that would be a good idea in any case... Thanks for the answer - Dan Rosenstark 2009-06-17 00:57
Ads