🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
SysTurnkeyTraceLog Pattern
This page was created by Charles on 2024-12-11. Last edited by Wikiadmin on 2026-07-29.

You can add the SysTurnkeyTraceLog pattern to a Turnkey application to record user navigations and actions for usage tracing and audit review.

SysTurnkeyTraceLog is also referred to as SysTurnkeyTrace or TraceLog. It is a recognized model pattern: when Turnkey discovers the pattern in your model, it tracks application usage and later persists the collected trace records as SysTurnkeyTrace objects.

What the pattern records

The pattern takes a snapshot when a user performs either of these events:

  • A navigation: a change of view.
  • An action: an Action Language execution that can result in a data change.

For example, if a user opens an Order view and then runs an action that changes the order, the navigation and the action are candidates for trace snapshots.

Add the pattern to your model

  1. Open your model in TK Live View.
  2. In LiveEdit, open the AssetsTK tab.
  3. Locate the SysTurnkeyTrace pattern and merge it into the model.
  4. Save and deploy the updated model to the Turnkey application.
  5. Exercise a navigation and an action in the application, then inspect the persisted SysTurnkeyTrace objects in your database or through an appropriate administrative view.

The pattern is available in the MDrivenComponents repository. Use the maintained pattern from that repository rather than recreating the pattern manually from an incomplete example.

Persistence interval and data-loss limit

Turnkey collects trace information in a batch and spools the batch to the database every 30 seconds. This reduces the number of database writes compared with writing one trace object for every event.

Situation Result
A user navigates or runs a tracked action Turnkey snapshots the trace information for the current batch.
The 30-second interval is reached Turnkey spools the batch to the database as SysTurnkeyTrace objects.
The server goes down before the current batch is spooled Trace information in that current batch can be lost.

Plan audits with this limit in mind. The trace pattern catches tracked activity during normal operation, but it does not guarantee persistence of events that are still in memory when a server stops.

Use alongside authentication

Trace records describe usage activity. If you also need application registration, sign-in, and authorization, add SysUserAuthentication. That pattern provides the user authentication model; SysTurnkeyTraceLog provides application-usage tracing.

See also