In 4D applications, the data file is important, so all the activity of the database is stored in the log file. As you all know, the log file is a vital element for the restoration of your database following an unfortunate contingency. However all the information on the database activity may also be useful for analysis. For example, to check the activity on a table, to see the changes made by a user, and to follow a record’s history.
Now you can extract the log contents into a JSON file using the new command LOG FILE TO JSON.
The LOG FILE TO JSON command provides more information like:
- Operation type
- Table name
- Process name
- Timestamp
- Workstation name
- …
For example:
[
{
"operationType":23,
"operationName":"Save seqnum",
"operationNumber":46,
"contextID":37,
"timeStamp":"2015-06-11T09:13:17.138Z",
"sequenceNumber":23,
"tableID":"5AFA15123F991C43B6ACF8B46A914BD0",
"tableName":"elem"
},
{
"operationType":24,
"operationName":"Create record",
"operationNumber":47,
"contextID":37,
"timeStamp":"2015-06-11T09:13:17.138Z",
"dataLen":570,
"recordNumber":7,
"tableID":"5AFA15123F991C43B6ACF8B46A914BD0",
"tableName":"elem",
"fields": {
"1": 9,
"2": "test value",
"3": "2003-03-03T00:00:00.000Z",
"4": "BlobPath: Table 1/Field 4/Data_9ACB28F1A2744FDFA5822B22F18B2E12.png",
"8": "BlobID: 2"
},
"extraData": {
"task_id": 1,
"user_name": "Vanessa Smith",
"user4d_id": 1,
"host_name": "iMac-VSmith-0833",
"task_name": "Application process",
"client_version": -1610541776
},
"primaryKey": "9"
}
]
The new command syntax is:
LOG FILE TO JSON ( pathFolder ; {size ; {pathName ; {mode}}} )
- pathFolder: Pathname of export folder.
- size: Maximum size of JSON file (in bytes).
- pathname: Pathname of the log file to be integrated. If undefined, 4D uses the current log file.
- mode: If empty or 1, the field values are prefixed by the field ID. If 2, the field values are prefixed by the field Name.
An example database is available to demonstrate the new functionality:
For more details, please take a look at the 4D v15 R4 Upgrade manual.