Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > log a stack trace

Reply
Thread Tools

log a stack trace

 
 
aidy
Guest
Posts: n/a
 
      08-26-2008
Hi,

Is it possible to log a stack trace to a text file?

Thanks

Aidy
 
Reply With Quote
 
 
 
 
Lars Christensen
Guest
Posts: n/a
 
      08-26-2008
On Aug 26, 12:32*pm, aidy <aidy.le...@googlemail.com> wrote:
> Is it possible to log a stack trace to a text file?


Yes: Raise an exception.

def backtrace
begin
fail
rescue Exception => e
return e.backtrace[1..-1]
end
end

File.open("backtrace.txt", "w") do |f|
f.puts backtrace
end

Lars
 
Reply With Quote
 
 
 
 
Thomas B.
Guest
Posts: n/a
 
      08-26-2008
aidy wrote:
> Hi,
>
> Is it possible to log a stack trace to a text file?
>
> Thanks
>
> Aidy


File:pen("file","w"){|f| f<<caller.join("\n")}
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
Seeking free trace log system for embedded protocol stack (Comemrcial) Baron Samedi C Programming 9 01-23-2007 05:10 AM
No trace messages using Diagnostics.Trace McGeeky ASP .Net 0 02-01-2006 02:49 PM
How to redirect output from Diagnostics.Trace to Page.Trace? Matthias S. ASP .Net 1 11-30-2005 09:01 AM
Trace: Can anyone suggest a good tool to catch trace messages? Rukmal Fernando ASP .Net 4 10-27-2003 09:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57