Re: Logging to screen with a WSGI application...


Hi,

When hosting a WSGI application you don't go through the full CherryPy
engine stack and therefore you don't have access to some functionnalities
such as logging.

Here you should just wrap your application into a WSGI middleware that
provides what you need, look for instance at the Paste translogger.

http://pythonpaste.org/modules/translogger.html#module-paste.translogger

- Sylvain

>
> I have a WSGI application which I'm using CherryPy as the server for.
>
> It seems to work well, except exceptions are not logged to the
> screen---or anywhere else!
>
> When I swap out cherrypy with the wsgiref.simple_server, exceptions
> are logged to the screen.
>
> This is cherrypy 3.1.1.
>
> If I print out the default value for cherrypy.log.screen, it is set to
> True.
>
> My understanding is there is also a log.screen variable for each
> application?  How do I access this to see what it is set to?
(Continue reading)

Sam | 3 Dec 01:02

Re: Logging to screen with a WSGI application...


Sylvain...

Thank you so much for the response.

I was unable to get translogger to work.  Your response led me to a
google search which found the pretty cool (but undocumented) package
wsgilog.  I've preliminary tested that and it seems to work well.  So
that's the good news.

I'd still like to figure out how to use translogger.

I wrote a little test program to show exactly what the issue
is...first here are the results after running it and running "curl
localhost:8202" against it...

I get the same results for the wrapped in translogger app with
cherrypy and the unwrapped  cherrypy.

The results I want are something like the results (showing the
exception) when using the simple server (as illustrated below.)

% ./error-test.py cherrypy
Server is:  cherrypy
Got here

% ./error-test.py logged_cherrypy
Server is:  logged_cherrypy
Got here

(Continue reading)


Gmane