[Flask] User specific log files

Kevin Stone Kevin.Stone at jax.org
Mon Feb 1 15:55:42 EST 2016


?Hi,


I am not the most familiar with the python logging framework, and I think I need some help on developing an approach for creating user specific log files in Flask. It would be even better if someone has already done this before and could share their pattern.



The problem I want to solve is this:

1) user1 and user2 both log in to the app

2) user1's activity is logged in "user1.log". user2's activity is logged in "user2.log".

3) No other user's activity should appear in that user's log file.



Ideally, I would like to tap into existing loggers that I have (e.g. the app logger and the SQLAlchemy logger), but I don't know if that is possible. My first naive attempt simply registers additional handlers at login time to the app.logger. This created the appropriate log files, but they had all activity from all users writing to them.



Any help or advice would be appreciated.

Thanks,

-Kevin

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160201/5660a55e/attachment.html>


More information about the Flask mailing list