> Hi > > Is there a way to log the request body (POST data) to uWSGI's log file, > for debugging purposes? > > I have stumbled onto two problems: > - I could not find the default value of logformat, either at > http://uwsgi-docs.readthedocs.org/en/latest/LogFormat.html or in the > sources, in order to just add a variable at the end of it; > - I could not find a variable or function that would output the request > body. > > Ideally it would be great if the body was logged as a C or Python literal > string, with escapes for newlines and non-printable chars, so that the > entire value can be appended to the request log line. > > It would also be useful to set a maximum size to the body being logged > (eg. 2k) so as not to log huge file uploads. > > Is this at all possible, given uWSGI's architecture? > >
The request body is a very particular beast, it could be in ram, it could be on disk, it could be half-readed and every language/platform use it in a different way. I think the easiest approach would be using the already available post-buffering and instead of writing to a tmpfile, you could write to the specified filename. https://github.com/unbit/uwsgi/blob/master/core/reader.c#L445 basically instead of using tmpfile(), you use fopen("something", "w") -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
