[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

logging a backtrace

snacktime

8/27/2006 3:36:00 AM

If I catch an exception, is there a way to produce a backtrace that I
can log using something like logger?

3 Answers

Ezra Zygmuntowicz

8/27/2006 4:17:00 AM

0


On Aug 26, 2006, at 8:35 PM, snacktime wrote:

> If I catch an exception, is there a way to produce a backtrace that I
> can log using something like logger?
>


rescue Exception => e
logger.error "#{ e.message } - (#{ e.class })" << "\n" <<
(e.backtrace or []).join("\n")
end

That is what I use to get a decent looking backtrace

-Ezra

snacktime

8/27/2006 4:33:00 AM

0

On 8/26/06, Ezra Zygmuntowicz <ezmobius@gmail.com> wrote:
>
> On Aug 26, 2006, at 8:35 PM, snacktime wrote:
>
> > If I catch an exception, is there a way to produce a backtrace that I
> > can log using something like logger?
> >
>
>
> rescue Exception => e
> logger.error "#{ e.message } - (#{ e.class })" << "\n" <<
> (e.backtrace or []).join("\n")
> end
>
> That is what I use to get a decent looking backtrace
>
> -Ezra

Thanks, that's just what I was looking for.

Barack Hussein Bohica

9/30/2011 10:07:00 AM

0

On 29 Sep 2011 04:59:45 GMT, rfischer@sonic.net (Ray Fischer) wrote:

>Kook

Reflecting on your life again, Ray?