SoftSlate Commerce
Home » Documentation » HTML Documentation

Version 3.3.5

Version 3.3.5 includes support for database audit logging with Envers. This page of the SoftSlate blog describes our implementation in detail. Upon upgrading, Envers is turned off by default and you do not need to do anything if you don't want to turn it on. However, upon running the upgrade's .sql scripts, all of the audit tables will be added to the database so it is ready to start logging if and when you choose to.

To turn on Envers audit logging, add the following to your hibernate.properties file and restart:

hibernate.listeners.envers.autoRegister=true
org.hibernate.envers.track_entities_changed_in_revision=true
org.hibernate.envers.global_with_modified_flag=true
org.hibernate.envers.store_data_at_delete=true
					

A special consideration when upgrading is whether or not to track when each revision is replaced in each audit table, and if this is desired, whether or not to *seed* the audit tables with existing data first. SoftSlate includes optional support for tracking when each revision in replaced in each audit table (see the above blog post for more information). To enable that support, add the following lines to hibernate.properties:

org.hibernate.envers.audit_strategy=com.softslate.commerce.daos.core.AppValidityAuditStrategy
org.hibernate.envers.audit_strategy_validity_store_revend_timestamp=true
					

Before enabling this, consider whether or not you'd like to seed the audit tables first with existing data. A file has been provided with the upgrade that seeds/populates all of the audit tables with existing data from the database. To properly seed the audit tables, you should make sure all the tables have been cleared out first (you'll lose any information that has already been logged), and then run the script to seed them. The recipe to follow is:

  1. Stop the application.
  2. Run WEB-INF/src/resources/upgrades/upgrade_3.3.4_3.3.5_[database].sql against your database, which will completely drop and re-create the audit tables.
  3. Run the script to seed the tables with existing data against your database: WEB-INF/src/resources/envers/seed_audit_tables.sql.
  4. Restart the application.

Copyright © 2009-2017 SoftSlate, LLC. All Rights Reserved.

Powered by SoftSlate Commerce

Foraker Design