Write stack traces to stderr?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Write stack traces to stderr?

David Farber
Does anyone have code that will write stack traces to stderr--the  
idea being that walkbacks in my Seaside image will get written to the  
Apache error log?

Thanks,
David

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Write stack traces to stderr?

keith1y
David Farber wrote:
> Does anyone have code that will write stack traces to stderr--the idea
> being that walkbacks in my Seaside image will get written to the
> Apache error log?
>
> Thanks,
> David
squeaksource.com/Logging has a Syslog back end, and a stack trace generator

Keith
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Write stack traces to stderr?

Philippe Marschall
In reply to this post by David Farber
2009/5/2 David Farber <[hidden email]>:
> Does anyone have code that will write stack traces to stderr

AFAIK Squeak does not have the ability to write to stderr from
"userland" (Squeak code) by default. AFAIK you'll have to load
OSProcess.

> the idea being
> that walkbacks in my Seaside image will get written to the Apache error log?

I don't think this will happen unless you run Squeak as an Apache
module which has not been implemented as you wouldn't want it anyway.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Write stack traces to stderr?

Andreas.Raab
Philippe Marschall wrote:
> 2009/5/2 David Farber <[hidden email]>:
>> Does anyone have code that will write stack traces to stderr
>
> AFAIK Squeak does not have the ability to write to stderr from
> "userland" (Squeak code) by default. AFAIK you'll have to load
> OSProcess.

Try this instead:

stdout := FileStream oldFileNamed: '/dev/stdout'.
stderr := FileStream oldFileNamed: '/dev/stderr'.

We use this quite a bit on our servers.

Cheers,
   - Andreas
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Write stack traces to stderr?

Igor Stasenko
2009/5/2 Andreas Raab <[hidden email]>:

> Philippe Marschall wrote:
>>
>> 2009/5/2 David Farber <[hidden email]>:
>>>
>>> Does anyone have code that will write stack traces to stderr
>>
>> AFAIK Squeak does not have the ability to write to stderr from
>> "userland" (Squeak code) by default. AFAIK you'll have to load
>> OSProcess.
>
> Try this instead:
>
> stdout := FileStream oldFileNamed: '/dev/stdout'.
> stderr := FileStream oldFileNamed: '/dev/stderr'.
>
> We use this quite a bit on our servers.

Unfortunately, this is not platform neutral solution.

>
> Cheers,
>  - Andreas
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Best regards,
Igor Stasenko AKA sig.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Write stack traces to stderr?

David Farber
In reply to this post by David Farber
Thanks for the replies, guys.

After nosing around a bit, it looks like I need to modify WAResponse  
class>>internalError: to see errors raised during the construction of  
a response (and write a stack trace out to a log).  But it strikes me  
as odd that Seaside doesn't already have a facility for logging  
errors.  Am I missing something?!

To catch errors that occur outside of a response (like the failure to  
snapshot image that brought my Pier image to its knees) it looks like  
I might need a new ToolSet.

Thanks,
David

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Write stack traces to stderr?

David Farber
On May 2, 2009, at 3:41 PM, David Farber wrote:

> After nosing around a bit, it looks like I need to modify  
> WAResponse class>>internalError: to see errors raised during the  
> construction of a response (and write a stack trace out to a log).  
> But it strikes me as odd that Seaside doesn't already have a  
> facility for logging errors.  Am I missing something?!

OK, I was off a bit on that one.  I see now that there is a  
configurable Error Handler that defaults to WAWalkbackErrorHandler.  
As a quick hack, if I redefine WAWalkback>>initializeWithException:  
like below, then I get what I want.

initializeWithException: anException
        | context |
        exception := anException.
        context := anException signalerContext.
        FileStream oldFileNamed: '/dev/stderr' do: [:file |
                file lineEndConvention: #lr.
                file wantsLineEndConversion: true.
                context errorReportOn: file].
        frames := OrderedCollection new.
        [ context isNil ] whileFalse: [
                frames add: context.
                context := context sender ].
        limit := 5 min: frames size

So what I need is a custom ErrorHandler that prints a simple  
acknowledgment message and logs the error.  I think I can handle that.

While I am here, let me switch to a Pier question real quick.  How  
can I generate an error page that uses the header and footer of site?

Thanks,
David

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside