|Subscribe to DataMgr|
|Visit this group|
DataMgr can keep track of all of the data changes that it makes. If you want to have DataMgr log all of the actions that it takes (that change the data in the database), call the startLogging method. By default, DataMgr will log these actions in a table called "datamgrLogs". If you want it to use another table, just pass in the name of that table when calling the startLogging method.
This can be useful to debug problems or for a very low-level history. If you know that you want a history of a certain kind of action (trouble tickets, for example), this feature would not be a good way to accomplish this.
Example of storing actions to "mylogs" table:
If you want DataMgr to stop logging actions, simply call the stopLogging method:
Here is the XML DataMgr uses define the logging table:
<table name="#variables.logtable#"> <field ColumnName="LogID" CF_DataType="CF_SQL_INTEGER" PrimaryKey="true" Increment="true" /> <field ColumnName="tablename" CF_DataType="CF_SQL_VARCHAR" Length="180" /> <field ColumnName="pkval" CF_DataType="CF_SQL_VARCHAR" Length="250" /> <field ColumnName="action" CF_DataType="CF_SQL_VARCHAR" Length="60" /> <field ColumnName="DatePerformed" CF_DataType="CF_SQL_DATE" Special="CreationDate" /> <field ColumnName="data" CF_DataType="CF_SQL_LONGVARCHAR" /> </table>
It stores the table against which an action was taken, the primary key of the record being affected (if it has a simple primary key), the action taken, and the date and time the action was taken. The data field holds a WDDX string of the structure that was passed in to the method that took the action. This may include keys not in the database - which will allow you to add in other information to the logging (such as comments about the action).
Note that you can also manually log an action by calling the logAction() method (assuming you have at some point called startLogging() so that DataMgr will create the logging table). Just pass in the tablename, pkval (the value of the primary key field for the record), a string to indicate the action, and a structure of data (logAction handles converting it to WDDX).
DataMgr does not provide any means to retrieve data from the log table, you will have to handle that outside of DataMgr.