librelist archives

« back to archive

Werkzeug logging of request variables

Werkzeug logging of request variables

From:
Sjoerd Huisman
Date:
2014-03-25 @ 10:41
Hi all,

Flask and Werkzeug provide in non-debugging mode a nice logging 
experience. I have attached a file handler, where all the exceptions are 
logged with a standard traceback. Is it also possible to change the format
to include session variables (e.g. username)?

>>  Implement the .setFormatter function does not work. The additional 
session variables are not present in the create_app function. How can I 
otherwise inject logging variables on request level?

>> Create a CustomFilter which will inject the variables, does not work. 
The filter is not able to find the application context.

Any other ideas?

Thanks