[Web-SIG] logging support in a multiprocess web server
graham.dumpleton at gmail.com
Wed Dec 17 21:43:18 CET 2008
2008/12/18 Manlio Perillo <manlio_perillo at libero.it>:
> I have noted that some WSGI based web applications use the standard logging
> module, for logging.
> However I have some doubts about how this works when the application is
> embedded in a web server that uses multiple processes (like Nginx or Apache
> with prefork).
The logging module principally provides the interface for logging. If
none of the supplied output logging handlers are suitable for what you
want then you create and register your own. What underlying logging
handler you use isn't going to change the high level interface that
WSGI based web applications are going to use.
For multiple process applications, one option is
logging.handlers.SysLogHandler. In Apache/mod_wsgi, since sys.stderr
is already linked to Apache error logs and deals with multiple
processes, you could just use a handler which outputs to sys.stderr.
Only issue with Apache/mod_wsgi is that sys.stderr gets logged in
Apache as ERROR level only, with logging module log levels being a
secondary layer within that.
More information about the Web-SIG