Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-20 Thread WarGrey Gyoudmon Ju
I just use the log facility that operating system uses, say, rsyslog.
rsyslog is configured to forward all logs via UDP, and there is another
racket UDP server that displays these logs on the terminal or sends to
other dev-ops. (rsyslog can be run as a normal user, then you can setup
your own log management strategy.)


On Fri, Mar 18, 2016 at 8:37 AM, Marc Kaufmann 
wrote:

> Hm, it sounded like I needed sudo rights to run daemontools if I want to
> use it to start racket as sudo (I may be wrong). Either way, the admins
> told me no, so no it is. Either supervisord or daemontools are of course
> several steps up from my previous way of doing things (which may justify
> their reasons for not giving me said sudo rights in the first place...).
>
> On Thu, Mar 17, 2016 at 8:29 PM, John Clements 
> wrote:
>
>>
>> > On Mar 17, 2016, at 4:48 PM, Marc Kaufmann 
>> wrote:
>> >
>> > Yep, printing that out is indeed all I want. I hadn't thought about the
>> fact that 'print and 'display will show up in standard output.
>> >
>> > John, how do you use drrackt's log handlers, are you running the server
>> via Drracket or did you mean something different.
>>
>> Forgive me, of course I didn’t mean “DrRacket’s log handlers,” but rather
>> “racket’s log handlers”, specifically those created by `define-logger`. My
>> mistake.
>> >
>> > I can't use daemontools for reasons to do with permissions, but I will
>> have access to supervisord, which seems to be doing the same type of tasks.
>>
>> ??
>>
>> I claim you can run daemontools (specifically, svscan) without any
>> permissions at all. Regardless, AFAIK supervisord does in fact achieve
>> similar ends.
>>
>> John
>>
>> >
>> > On Thu, Mar 17, 2016 at 4:46 PM, John Clements <
>> cleme...@brinckerhoff.org> wrote:
>> >
>> > > On Mar 17, 2016, at 11:50 AM, Marc Kaufmann <
>> marc.kaufman...@gmail.com> wrote:
>> > >
>> > > Hi all,
>> > >
>> > > I do not want people to see "Contract violation: massive stack trace
>> documenting my brilliance as a programmer" every time they hit a bug on my
>> website.
>> > >
>> > > Currently I show them simply an error page and redirect the trace to
>> stderr (see code below). But this doesn't track time of the error, and so
>> on. Is there a simple way to do this (seems like it should be a common
>> problem), or at least how to easily get the time-stamp from
>> servlet-error-response without having to manually pipe everything to stderr?
>> >
>> > I think this problem is one of the ones that falls into the “Lisp
>> crack”: specifically, implementing your own solution is sufficiently easy
>> that building a general-purpose solution winds up being more trouble than
>> it’s worth, and never quite covers all of the various users’ requirements.
>> Of course, this leads to lack of standardization.
>> >
>> > For me, I use drracket’s log handlers, make sure that everything winds
>> up on stdout, and then use ‘multilog’ from ‘daemontools’ to take care of
>> timestamps, partitioning (if desired) and log rotation.
>> >
>> > John
>> >
>> >
>> >
>> >
>>
>>
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-19 Thread Jay McCarthy
I would just make my-error-responder print out date->string's result
on current-seconds. Is that now what you want?

On Thu, Mar 17, 2016 at 2:50 PM, Marc Kaufmann
 wrote:
> Hi all,
>
> I do not want people to see "Contract violation: massive stack trace
> documenting my brilliance as a programmer" every time they hit a bug on my
> website.
>
> Currently I show them simply an error page and redirect the trace to stderr
> (see code below). But this doesn't track time of the error, and so on. Is
> there a simple way to do this (seems like it should be a common problem), or
> at least how to easily get the time-stamp from servlet-error-response
> without having to manually pipe everything to stderr?
>
> Cheers,
>
> Marc
>
> #lang racket
>
> (require ...)
>
> (define error-response
>   (response/xexpr
> `(html
>,(html-head "Error")
>(body
>  (h1 "An error occurred")
>  (p "We are sorry, but an error occurred.")
>  (p "Please contact the person who is responsible for this mess to
> fix it.")
>
> (define (my-error-responder url exn)
>   ((response-output (servlet-error-responder url exn)) (current-error-port))
>   error-response)
>
> (serve/servlet start
>#:log-file (build-path "local.logs")
>#:servlet-path "/"
>#:launch-browser? #f
>#:servlet-regexp #rx""
>#:extra-files-paths (list (build-path "htdocs"))
>#:servlet-responder my-error-responder
>)
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-19 Thread Marc Kaufmann
Yep, printing that out is indeed all I want. I hadn't thought about the
fact that 'print and 'display will show up in standard output.

John, how do you use drrackt's log handlers, are you running the server via
Drracket or did you mean something different.

I can't use daemontools for reasons to do with permissions, but I will have
access to supervisord, which seems to be doing the same type of tasks.

On Thu, Mar 17, 2016 at 4:46 PM, John Clements 
wrote:

>
> > On Mar 17, 2016, at 11:50 AM, Marc Kaufmann 
> wrote:
> >
> > Hi all,
> >
> > I do not want people to see "Contract violation: massive stack trace
> documenting my brilliance as a programmer" every time they hit a bug on my
> website.
> >
> > Currently I show them simply an error page and redirect the trace to
> stderr (see code below). But this doesn't track time of the error, and so
> on. Is there a simple way to do this (seems like it should be a common
> problem), or at least how to easily get the time-stamp from
> servlet-error-response without having to manually pipe everything to stderr?
>
> I think this problem is one of the ones that falls into the “Lisp crack”:
> specifically, implementing your own solution is sufficiently easy that
> building a general-purpose solution winds up being more trouble than it’s
> worth, and never quite covers all of the various users’ requirements. Of
> course, this leads to lack of standardization.
>
> For me, I use drracket’s log handlers, make sure that everything winds up
> on stdout, and then use ‘multilog’ from ‘daemontools’ to take care of
> timestamps, partitioning (if desired) and log rotation.
>
> John
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-18 Thread 'John Clements' via Racket Users

> On Mar 17, 2016, at 11:50 AM, Marc Kaufmann  wrote:
> 
> Hi all,
> 
> I do not want people to see "Contract violation: massive stack trace 
> documenting my brilliance as a programmer" every time they hit a bug on my 
> website.
> 
> Currently I show them simply an error page and redirect the trace to stderr 
> (see code below). But this doesn't track time of the error, and so on. Is 
> there a simple way to do this (seems like it should be a common problem), or 
> at least how to easily get the time-stamp from servlet-error-response without 
> having to manually pipe everything to stderr?

I think this problem is one of the ones that falls into the “Lisp crack”: 
specifically, implementing your own solution is sufficiently easy that building 
a general-purpose solution winds up being more trouble than it’s worth, and 
never quite covers all of the various users’ requirements. Of course, this 
leads to lack of standardization.

For me, I use drracket’s log handlers, make sure that everything winds up on 
stdout, and then use ‘multilog’ from ‘daemontools’ to take care of timestamps, 
partitioning (if desired) and log rotation.

John



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-18 Thread 'John Clements' via Racket Users

> On Mar 17, 2016, at 4:48 PM, Marc Kaufmann  wrote:
> 
> Yep, printing that out is indeed all I want. I hadn't thought about the fact 
> that 'print and 'display will show up in standard output. 
> 
> John, how do you use drrackt's log handlers, are you running the server via 
> Drracket or did you mean something different. 

Forgive me, of course I didn’t mean “DrRacket’s log handlers,” but rather 
“racket’s log handlers”, specifically those created by `define-logger`. My 
mistake. 
> 
> I can't use daemontools for reasons to do with permissions, but I will have 
> access to supervisord, which seems to be doing the same type of tasks. 

??

I claim you can run daemontools (specifically, svscan) without any permissions 
at all. Regardless, AFAIK supervisord does in fact achieve similar ends.

John

> 
> On Thu, Mar 17, 2016 at 4:46 PM, John Clements  
> wrote:
> 
> > On Mar 17, 2016, at 11:50 AM, Marc Kaufmann  
> > wrote:
> >
> > Hi all,
> >
> > I do not want people to see "Contract violation: massive stack trace 
> > documenting my brilliance as a programmer" every time they hit a bug on my 
> > website.
> >
> > Currently I show them simply an error page and redirect the trace to stderr 
> > (see code below). But this doesn't track time of the error, and so on. Is 
> > there a simple way to do this (seems like it should be a common problem), 
> > or at least how to easily get the time-stamp from servlet-error-response 
> > without having to manually pipe everything to stderr?
> 
> I think this problem is one of the ones that falls into the “Lisp crack”: 
> specifically, implementing your own solution is sufficiently easy that 
> building a general-purpose solution winds up being more trouble than it’s 
> worth, and never quite covers all of the various users’ requirements. Of 
> course, this leads to lack of standardization.
> 
> For me, I use drracket’s log handlers, make sure that everything winds up on 
> stdout, and then use ‘multilog’ from ‘daemontools’ to take care of 
> timestamps, partitioning (if desired) and log rotation.
> 
> John
> 
> 
> 
> 



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-18 Thread Marc Kaufmann
Hm, it sounded like I needed sudo rights to run daemontools if I want to
use it to start racket as sudo (I may be wrong). Either way, the admins
told me no, so no it is. Either supervisord or daemontools are of course
several steps up from my previous way of doing things (which may justify
their reasons for not giving me said sudo rights in the first place...).

On Thu, Mar 17, 2016 at 8:29 PM, John Clements 
wrote:

>
> > On Mar 17, 2016, at 4:48 PM, Marc Kaufmann 
> wrote:
> >
> > Yep, printing that out is indeed all I want. I hadn't thought about the
> fact that 'print and 'display will show up in standard output.
> >
> > John, how do you use drrackt's log handlers, are you running the server
> via Drracket or did you mean something different.
>
> Forgive me, of course I didn’t mean “DrRacket’s log handlers,” but rather
> “racket’s log handlers”, specifically those created by `define-logger`. My
> mistake.
> >
> > I can't use daemontools for reasons to do with permissions, but I will
> have access to supervisord, which seems to be doing the same type of tasks.
>
> ??
>
> I claim you can run daemontools (specifically, svscan) without any
> permissions at all. Regardless, AFAIK supervisord does in fact achieve
> similar ends.
>
> John
>
> >
> > On Thu, Mar 17, 2016 at 4:46 PM, John Clements <
> cleme...@brinckerhoff.org> wrote:
> >
> > > On Mar 17, 2016, at 11:50 AM, Marc Kaufmann 
> wrote:
> > >
> > > Hi all,
> > >
> > > I do not want people to see "Contract violation: massive stack trace
> documenting my brilliance as a programmer" every time they hit a bug on my
> website.
> > >
> > > Currently I show them simply an error page and redirect the trace to
> stderr (see code below). But this doesn't track time of the error, and so
> on. Is there a simple way to do this (seems like it should be a common
> problem), or at least how to easily get the time-stamp from
> servlet-error-response without having to manually pipe everything to stderr?
> >
> > I think this problem is one of the ones that falls into the “Lisp
> crack”: specifically, implementing your own solution is sufficiently easy
> that building a general-purpose solution winds up being more trouble than
> it’s worth, and never quite covers all of the various users’ requirements.
> Of course, this leads to lack of standardization.
> >
> > For me, I use drracket’s log handlers, make sure that everything winds
> up on stdout, and then use ‘multilog’ from ‘daemontools’ to take care of
> timestamps, partitioning (if desired) and log rotation.
> >
> > John
> >
> >
> >
> >
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.