[Zope3-dev] Re: [ZODB-Dev] revise transaction API

Steve Alexander steve at z3u.com
Thu Mar 25 03:30:54 EST 2004


> So my question is: Is there a "standard" idiom one would use to
> implement this, even if the data is not stored outside of the ZODB?

Here's what I did for a Zope 3 application, although it applies to Zope 
2 as well.

The application has a logging system that uses Python's standard logging 
library, but also adds the current transaction id to each log entry. 
The application logs things that happen, such as users logging in and 
logging out, and attempted (but failed) logins.  The system also logs 
when a transaction is started, aborted, or finished.

When you read such a log file, you can choose whether a particular 
logged event should be considered only if its transaction is committed, 
or if the event should be considered on its own merit, whether or not 
the transaction is committed.

I spit these logs out to the filesystem, but you can do whatever you 
want with them.

The applicaton can read these log files and present them to an 
administrator, with the log entries arranged by transaction id.

A separate application can 'tail' the log file, note if some important 
event occurs (such as three successive failed attempted logins), and 
send a message to the application that it needs to lock out that user.

I haven't thought much about how to make this system work with ZEO. 
Perhaps the storage server could write the log files, and the logging 
messages could be passed along with ZEO messages.

--
Steve Alexander




More information about the ZODB-Dev mailing list