# Should be simple: Get all levels of stack trace from failed server startup

**URL:** <https://www.ruby-forum.com/t/should-be-simple-get-all-levels-of-stack-trace-from-failed-server-startup/174432>\
**Category:** Rails\
**Created:** [August 26, 2009, 6:21pm UTC](https://www.ruby-forum.com/t/should-be-simple-get-all-levels-of-stack-trace-from-failed-server-startup/174432 "2009-08-26T18:21:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://www.ruby-forum.com/u/steve)\
**Post date:** [August 26, 2009, 6:21pm UTC](https://www.ruby-forum.com/t/should-be-simple-get-all-levels-of-stack-trace-from-failed-server-startup/174432/1 "2009-08-26T18:21:25Z")

</div>

Hi,

I am trying to debug another problem that occurs when starting the web  
server (either Mongrel or Webrick). The error message it gives me is  
useless, because it hides “…22 levels…”. Unfortunatly, the first  
few lines are inside of active scaffold, and the last few are inside  
of the server, leaving me with nothing to debug. How do I view all  
lines of this stack trace? I checked the logs, nothing. I tried  
starting the server in debug mode and this fails because I am using  
Windows.

Thanks,

Steve

---

<div class="post-metadata">

**Author:** ![steve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://www.ruby-forum.com/u/steve)\
**Post date:** [August 26, 2009, 8:23pm UTC](https://www.ruby-forum.com/t/should-be-simple-get-all-levels-of-stack-trace-from-failed-server-startup/174432/2 "2009-08-26T20:23:49Z")

</div>

Hi Steve,

On Wed, 2009-08-26 at 08:20 -0700, Steve wrote:

> Hi,
> 
> I am trying to debug another problem that occurs when starting the web  
> server (either Mongrel or Webrick). The error message it gives me is  
> useless, because it hides “…22 levels…”.

You might want to go ahead and post the trace you are getting. Someone  
here might have had a similar problem and recognize it.

> I tried starting the server in debug mode and this fails because I  
> am using Windows.

Not sure what you mean by ‘fails’ here. I just double checked and had  
no problem with ‘ruby script\server -u’. Say more.

Best regards,  
Bill

---

<div class="post-metadata">

**Author:** ![steve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://www.ruby-forum.com/u/steve)\
**Post date:** [August 27, 2009, 2:56am UTC](https://www.ruby-forum.com/t/should-be-simple-get-all-levels-of-stack-trace-from-failed-server-startup/174432/3 "2009-08-27T02:56:41Z")

</div>

Quoting S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Windows.

Google is your friend, search “full stack backtrace in Ruby”, 1st  
result,  
follow forum link to first reply:

From: Brian C. \<B.Candler [pobox.com](http://pobox.com)\>  
Date: Sun, 10 Oct 2004 20:12:29 +0900  
References: 115962  
In-reply-to: 115962

On Sun, Oct 10, 2004 at 08:02:20PM +0900, Alexey V. wrote:

> Below is a typical Rails exception thrown from within functional tests.  
> The interesting part of this exception (test and application code) is  
> precisely within “… 18 levels…” that are hidden by the interpreter.
> 
> Is there any good way to convince Ruby to print full stack trace?

I had the same issue a couple of years ago, and I ended up grepping  
through  
the interpreter C source for the string “levels…” to find it.

Doing so again… it looks like these are hard-coded constants in eval.c

#define TRACE\_HEAD 8  
#define TRACE\_TAIL 5

So you can change these (and recompile ruby). But I think what I did in  
the  
end was just wrap the code with my own exception catcher, since the full  
backtrace array is available to you:

def foo(y)  
raise “hell” if y \<= 0  
foo(y-1)  
end

begin  
foo(75)  
rescue Exception =\> e  
puts “Exception: #{e.class}:  
#{e.message}\n\t#{e.backtrace.join(”\n\t")}"  
exit 1  
end

Regards,

Brian.
