Opened 18 years ago
Closed 14 years ago
#108 closed enhancement (fixed)
Logging the change history of an item
Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|
Priority: | minor | Milestone: | BASE 2.13 |
Component: | core | Version: | |
Keywords: | Cc: |
Description
Implement a log function that logs whenever an item is modified. It should be able to store time and logged in user. If possible, it could also store the old and new values of the changed properties. It should be possible for a server admin to configure if this function should be enabled and how much info that should be logged. If possible, the function could be pluggable to allow logging into other places than the database.
Change History (34)
comment:1 Changed 18 years ago by
Milestone: | → BASE 2.0 |
---|
comment:2 Changed 17 years ago by
Milestone: | BASE 2.0 → BASE 2.0+ |
---|
comment:3 Changed 17 years ago by
Milestone: | BASE 2.x+ → BASE 2.2 |
---|
comment:4 Changed 17 years ago by
Milestone: | BASE 2.2 → BASE 2.x+ |
---|
comment:5 Changed 14 years ago by
comment:6 Changed 14 years ago by
Status: | new → assigned |
---|
I'll give this a try a see what comes out...
comment:7 Changed 14 years ago by
Milestone: | BASE 2.x+ → BASE 2.13 |
---|
comment:8 Changed 14 years ago by
(In [5038]) References #108: Logging the change history of an item
This enables configurable logging possibility. An implementation that logs to the database is supplied but turned off by default. All annotatable items has got support for logging, but only changes that happens on the item itself is logged. Eg. changes to annotations, files, etc. are not yet possible to log.
A single log entry corresponds to one database transaction and contains information about:
- Date and time
- The user that made the change
- The session that the change was made in
- Which client application that was used
- Which project that was active
- Which plug-in/job that was executing when the change was made
- All items that was created/modified/deleted in the transaction
comment:9 Changed 14 years ago by
comment:10 Changed 14 years ago by
comment:11 Changed 14 years ago by
comment:12 Changed 14 years ago by
comment:13 Changed 14 years ago by
comment:14 Changed 14 years ago by
comment:15 Changed 14 years ago by
(In [5054]) References #108: Logging the change history of an item
- Added special logger implementation for annotations. At the moment it can only catch CREATE and DELETE changes, since updating annotation only results in a change in the ParameterValues? table. I'll figure out a way to fix it.
comment:16 Changed 14 years ago by
comment:17 Changed 14 years ago by
(In [5057]) References #108: Logging the change history of an item
- Use WeakReference? in LogControl?.DbControl? to make sure the DbControl? is garbage collected correctly (test in TestDbControl? failed)
comment:18 Changed 14 years ago by
(In [5058]) References #108: Logging the change history of an item
- We must tell DbControll?.reattach() if the item has been updated while it was detached or not or the logging will not work as expected. NOTE!!! This is a backwards compatibility problem that needs to be documented!!!
comment:19 Changed 14 years ago by
(In [5059]) References #108: Logging the change history of an item
- Fixes a NullPointerException? that prevent annotated items from being deleted.
comment:20 Changed 14 years ago by
(In [5060]) References #108: Logging the change history of an item
- Documented the change made in [5058]
- Changed calls to DbControl?.reattachItem() from all core code and jsp scripts
comment:21 Changed 14 years ago by
comment:22 Changed 14 years ago by
comment:23 Changed 14 years ago by
(In [5063]) References #108: Logging the change history of an item
- Added special loggers for data files (FileSetMember?) and plate events
comment:24 Changed 14 years ago by
comment:25 Changed 14 years ago by
comment:26 Changed 14 years ago by
comment:27 Changed 14 years ago by
comment:28 Changed 14 years ago by
comment:29 Changed 14 years ago by
comment:30 Changed 14 years ago by
comment:31 Changed 14 years ago by
comment:32 Changed 14 years ago by
comment:33 Changed 14 years ago by
comment:34 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
There is a discussion about some problems related to this in ticket #966. I got a new idea that maybe can work out. It builds on the Hibernate hook that we can use to detect create/update events to items at a fine-grained level. Instead of trying to associate the event with the correct parent item at the time of the update we could just store the informatation that we have. Then, when someone is interested of seeing the change history of an item we can also find out which items are related and include the change history of those items. For example: if a user is interested in the change history of a sample, we will also load and merge the change histories of all annotations attached to the sample. This will be a lot easier than going backwards from the annotation to the sample at the time of the update.
In order to know which changes that are related everything in a single transaction should have the same 'transactionId'. The changes can also be linked to a Session, which allows us to know if the changes was made through a plug-in or directly in the web interface.
The log table should not have any "hard" foreign keys to other tables since that would block deletion of items. Instead we should consider implementing a cleaning functionality that at regular intervals removes the change history for items that no longer exists.
Not all items should be logged. We can use a tagging interface (eg. LoggableData?) that are added to classes that we want to log. It is a bad idea to log items that are batchable (eg. reporters). It would kill performance on the server.