I was trying to format the stdout with log encoders and stuck in a doubt.
Is possible to use "user-defined logvars" (
http://uwsgi-docs.readthedocs.org/en/latest/LogFormat.html#user-defined-logvars)
or something like that in the log encoder formart (
http://uwsgi-docs.readthedocs.org/en/latest/LogEncoders.html)?
Most precisely, I would like to append at every log generated by the
stdout, which worker/thread made it.
At python:
def application(environ, start_response):
start_response('200 OK', [('Content-Type','text/html')])
uwsgi.set_logvar('worker_id', str(uwsgi.worker_id))
uwsgi.set_logvar('request_id', str(uwsgi.request_id))
print "Wasabi"
return ["Hello World"]
At uwsgi.ini:
log-encoder = format ${micros} ${worker_id} ${request_id}
${strftime:%%a %%b %%d %%H:%%M:%%S} ${msgnl}
The example above is really simple, but was just to exemplify.. I always
can do this "format" at the point the stdout was generated, but as the app
already is running and a bit complex, I was trying to find something more
modularized and centralized.
There's something that I can do to this approach?
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi