[Web-SIG] loggers and wsgi

Chris Withers chris at simplistix.co.uk
Fri Feb 1 21:53:42 CET 2008


Manlio Perillo wrote:
> The interface of the python logging is:
>    log(level, msg[, *args[, **kwargs]])
> right?
> 
> 
> The problem with this is that, as an example, Twisted logging system 
> does not knows about log levels.
> 
> Moreover, the message formatting is not done by the logging system.

Then, at the worst case, twisted's wsgi server can handle this sensibly 
and process whatever is passed to .log in such a way that it can go to 
its own logging.

> Do you think that a WSGI application should not be able to use some 
> advanced features offered by a web server (for embedded WSGI applications)?

logging isn't a particularly advanced feature from my perspective.

> from sqlalchemy import engine
> 
> db = None
> 
> class application(environ, start_response):
>    global db
> 
>    if db is None:
>       # Setup the database connection
>       db = engine.create_engine(environ['database_uri'], echo_pool=???)
> 
> 
> what should I use for echo_pool?

I don't know what echo_pool is.

> Of course I can not use environ['wsgi.errors']

If you *really* wanted that to go to the front-end wsgi servers log (I'd 
just log it to its own log...) then I'd write a proxy object that handed 
calls off to whatever the current wsgi environ is or bitch if one wasn't 
available.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Web-SIG mailing list