[Web-SIG] serving (potentially large) files through wsgi?
manlio_perillo at libero.it
Fri Dec 21 18:40:51 CET 2007
Brian Smith ha scritto:
> Manlio Perillo wrote:
>> This is the same for Nginx.
>> sys.stderr is linked to the nginx main cycle logging,
>> wsgi.errors to the request logging.
> In Nginx, there is only one thread, right?
It is an asynchronous server, with support to multiprocessing.
> So, it should be a simple
> matter for the Nginx web_wsgi to keep track of the proper log file to
> redirects stderr and logging output to.
For wsgi.errors it is not a problem.
With sys.stderr now I redirect it to the main error log of nginx.
This means that all applications share the same log file.
I can modify the code, so that:
- sys.stderr for the main interpreter goes to the main error log
- sys.stderr for subinterpreters goes to the error log declared in the
HTTP location where the WSGI application is "mounted"
In mod_wsgi for nginx, there is a sub-interpreter for each
application, unless the application want to use the main interpreter (or
sub interpreters are disable - this is the default).
Two applications can not share the same sub interpreter, but they can
share the main interpreter.
Instead of using sys.stderr, a better solution is to add a new log
object to the WSGI environment dictionary, so that each application can
have its error log redirected to different files.
Well, for nginx this is not really an issue, since usually you want to
execute only one WSGI application per server.
More information about the Web-SIG