[Web-SIG] serving (potentially large) files through wsgi?

Brian Smith brian at briansmith.org
Fri Dec 21 18:07:53 CET 2007

Phillip J. Eby wrote:
> There are other logging systems out there besides the Python 
> logging module -- and some of them are better for their 
> specific purposes. 

If I was using a framework, I would use that framework's logging
package. But, I specifically want to limit my dependencies as much as
possible; that means using built-in modules whenever possible, even when
they are less convenient than the mirriad of third-party alternatives.

> And the Python logging module doesn't 
> give you any WSGI-level control over output.  At least if you 
> use wsgi.errors, you can have middleware that e.g. logs 
> different parts of your application tree to different log outputs.

My understanding of the WSGI spec is that wsgi.errors is only supposed
to be used for errors, not for tracing messages or other non-error
messages. How would a WSGI gateway go about enabling/disabling different
logging levels? Assume the default formatter was used, and use regexes?

> Which just goes to illustrate the problem of using a global 
> logging package that has only static context (which is one of 
> my pet peeves re: the logging module). In my experience, you
> more want to be able to filter and route logs by component
> *instance* (e.g. which page of your web app is being rendered)
> than by code module (e.g. templating library vs. db library).  

The built-in logging module allows you to do this already. But, it isn't
very convenient.

- Brian

More information about the Web-SIG mailing list