Opened 19 years ago

Closed 15 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 by Jari Häkkinen, 19 years ago

Milestone: BASE 2.0

comment:2 by Jari Häkkinen, 18 years ago

Milestone: BASE 2.0BASE 2.0+

comment:3 by Jari Häkkinen, 18 years ago

Milestone: BASE 2.x+BASE 2.2

comment:4 by Jari Häkkinen, 18 years ago

Milestone: BASE 2.2BASE 2.x+

comment:5 by Nicklas Nordborg, 15 years ago

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.

comment:6 by Nicklas Nordborg, 15 years ago

Status: newassigned

I'll give this a try a see what comes out...

comment:7 by Nicklas Nordborg, 15 years ago

Milestone: BASE 2.x+BASE 2.13

comment:8 by Nicklas Nordborg, 15 years ago

(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 by Nicklas Nordborg, 15 years ago

(In [5039]) References #108: Logging the change history of an item

  • Added core classes and test case.
  • Unreferenced history entries are deleted by cleanup.

comment:10 by Nicklas Nordborg, 15 years ago

(In [5041]) References #108: Logging the change history of an item

  • Only administrators get access to the change history by default.
  • It is possible to give this permission to other roles.

comment:11 by Nicklas Nordborg, 15 years ago

(In [5048]) References #108: Logging the change history of an item

  • Added list and view pages for the change history
  • The biosource view page is used as a prototype
  • Made it possible to disable the "Change history" with setting in base.config

comment:12 by Nicklas Nordborg, 15 years ago

(In [5050]) References #108: Logging the change history of an item

  • Added "Change history" tab to the other biomaterial pages

comment:13 by Nicklas Nordborg, 15 years ago

(In [5052]) References #108: Logging the change history of an item

  • Added option to include a list with the modified properties in the change log
  • Added special logger implementation for biomaterial events

comment:14 by Nicklas Nordborg, 15 years ago

(In [5053]) References #108: Logging the change history of an item

  • Changed default sort order to sort by descending time, eg. most recent change first.

comment:15 by Nicklas Nordborg, 15 years ago

(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 by Nicklas Nordborg, 15 years ago

(In [5056]) References #108: Logging the change history of an item

  • Annotation logger can now handle updates as well, due to a new 'last update' field in the annotation table.

comment:17 by Nicklas Nordborg, 15 years ago

(In [5057]) References #108: Logging the change history of an item

comment:18 by Nicklas Nordborg, 15 years ago

(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 by Nicklas Nordborg, 15 years ago

(In [5059]) References #108: Logging the change history of an item

comment:20 by Nicklas Nordborg, 15 years ago

(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 by Nicklas Nordborg, 15 years ago

(In [5061]) References #108: Logging the change history of an item

  • Add 'id' as an extra sort column so that events that have the same timestamp are sorted in the order they were added.

comment:22 by Nicklas Nordborg, 15 years ago

(In [5062]) References #108: Logging the change history of an item

  • Added "Change history" tab to view pages for Array lims items.

comment:23 by Nicklas Nordborg, 15 years ago

(In [5063]) References #108: Logging the change history of an item

  • Added special loggers for data files (FileSetMember) and plate events

comment:24 by Nicklas Nordborg, 15 years ago

(In [5064]) References #108: Logging the change history of an item

  • Added "Change history" tab to hyb, scan and raw bioassay pages
  • Added special logger for scan images

comment:25 by Nicklas Nordborg, 15 years ago

(In [5065]) References #108: Logging the change history of an item

  • Added "Change history" tab to file and formula view pages

comment:26 by Nicklas Nordborg, 15 years ago

(In [5066]) References #108: Logging the change history of an item

Only log annotation changes if the parent item is loggable.

comment:27 by Nicklas Nordborg, 15 years ago

(In [5067]) References #108: Logging the change history of an item

Makes it possible to find and log dirty collections.

comment:28 by Nicklas Nordborg, 15 years ago

(In [5068]) References #108: Logging the change history of an item

Added logger for annotation sets which makes it possible to detect changes to inherited annotations.

comment:29 by Nicklas Nordborg, 15 years ago

(In [5069]) References #108: Logging the change history of an item

  • Enabled logging for experiments
  • Added "Change history" tab to experiments, plugin configuration and protocol

comment:30 by Nicklas Nordborg, 15 years ago

(In [5070]) References #108: Logging the change history of an item

  • Enabled logging for annotation types

comment:31 by Nicklas Nordborg, 15 years ago

(In [5071]) References #108: Logging the change history of an item

  • Added the new data classes to UML diagram and made updates to all other affected diagrams
  • Documented the logging feature for plug-in developers
  • Made the new data classes immutable

comment:32 by Nicklas Nordborg, 15 years ago

(In [5072]) References #108: Logging the change history of an item

Added some more tests to the test program.

comment:33 by Nicklas Nordborg, 15 years ago

(In [5073]) References #108: Logging the change history of an item

Added "Changed items" tab to the job popup that makes it possible to show all changes made by that job.

comment:34 by Nicklas Nordborg, 15 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.