Opened 15 years ago

Closed 11 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 15 years ago by jari

Milestone: BASE 2.0

comment:2 Changed 14 years ago by jari

Milestone: BASE 2.0BASE 2.0+

comment:3 Changed 14 years ago by jari

Milestone: BASE 2.x+BASE 2.2

comment:4 Changed 14 years ago by jari

Milestone: BASE 2.2BASE 2.x+

comment:5 Changed 12 years ago by Nicklas Nordborg

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 Changed 11 years ago by Nicklas Nordborg

Status: newassigned

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

comment:7 Changed 11 years ago by Nicklas Nordborg

Milestone: BASE 2.x+BASE 2.13

comment:8 Changed 11 years ago by Nicklas Nordborg

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

(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 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

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

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

comment:13 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

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

(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 Changed 11 years ago by Nicklas Nordborg

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

comment:18 Changed 11 years ago by Nicklas Nordborg

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

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

comment:20 Changed 11 years ago by Nicklas Nordborg

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

(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 Changed 11 years ago by Nicklas Nordborg

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

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

comment:23 Changed 11 years ago by Nicklas Nordborg

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

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

comment:24 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

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

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

comment:26 Changed 11 years ago by Nicklas Nordborg

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

Only log annotation changes if the parent item is loggable.

comment:27 Changed 11 years ago by Nicklas Nordborg

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

Makes it possible to find and log dirty collections.

comment:28 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

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

  • Enabled logging for annotation types

comment:31 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

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

Added some more tests to the test program.

comment:33 Changed 11 years ago by Nicklas Nordborg

(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 Changed 11 years ago by Nicklas Nordborg

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