Application event logging
- From:
- Thadeus Burgess
- Date:
- 2010-09-17 @ 16:51
I need to be able to log events that happen during the system such as
"User x logged in" and "User x did y" and "System modified record
according to z".
I also need to be able to view all of the recent events from an admin
page, only the last 100 need to be accessible from the web, the rest
can be in actual log files.
I bring this up here because of the new logging support that will be
built into flask. Is that kind of logging the correct way to do this?
Or should I use a logger that connects to my postgres database?
--
Thadeus
Re: [flask] Application event logging
- From:
- Daniel Neuhäuser
- Date:
- 2010-09-17 @ 17:09
> I bring this up here because of the new logging support that will be
> built into flask. Is that kind of logging the correct way to do this?
> Or should I use a logger that connects to my postgres database?
Logbook has a handler for SQLAlchemy, so additionally to or instead of
sending log records via email or whatever you are using currently you
can use a database which handles this.
Also instead of showing the last 100 most recent events you might be
interested to know that logbook provides a special handler which gets
only triggered in case of a specific level at which previous log records
are passed on to the next handler. This way less critical events are
only emitted if they may have lead up to a more critical one.