Use the Event loggers¶
Introduction
Depending on the design requirements, whether to record only one type of event or several types of events with the same logger can be selected. Below, the effects of two configuration types are described:
Configuration |
Effects |
---|---|
A logger for each event type of interest |
|
A logger for several Types of Events of interest |
|
Note
the Audit event logger object is available in the template library, i.e. an Audit event logger already configured to record the UserSessionEvent, RecipeApplicationEvent and AuditConditionEventType event types.
The data recorded by the Event logger can be exported in CSV format, or displayed in the application in a data grid (see Display the stored data in a table).
Configure an Event logger
In Project, right-click Loggers, then click New > Event logger.
(Optional) To store in the database the translations of the localized strings (LocalizedText data, e.g. alarm event messages), insert the locale IDs in the Locales property (e.g. “en-US”, see Locale).
In the Database property, select the database in which to store the selected properties: a table for each event type is automatically created and configured in the database; and in each table, a column for each property to be stored.
Select the events of interest
To select an event of interest, in the Event logger properties, click next to Event configuration: the event’s set of configuration properties appears.
Set the event source nodes/objects:
Source
Event source property value
Listen subtree property value
any project object
(no value)
True
a node/object and all its child objects
dynamic link with the parent node/object
True
a specific project object
dynamic link with the specific object
False
In the Event type property, select the event type of interest.
Hint
for audit event types, it is recommended to create a dedicated logger.
To record only the events generated by user interactions with the application, set Exclude non-interactive sessions to True.
Repeat the previous steps for each event type of interest.
Select the properties of interest of the events
In Project double-click the Event logger object: the list of properties of all the selected event types is displayed in the object editor.
Select the property to record, then click Apply: the properties appear in the Event fields to log.
Note
when a property to record is selected, a dynamic link with it is automatically set inside Event fields to log. The dynamic link points to an attribute automatically selected by Q Studio. If the attribute does not represent the data of interest, select a different attribute in the dynamic link window.
Display the stored data in a table
Create a Data grid object and open it in the editor.
Drag the desired Event logger object from the Project panel into the Data grid object in the editor: the Data grid object is automatically configured to display the data stored in the database.
Note
to display the data updated in real time at runtime, configure the call of the Update method of the Data grid object. Typically, this method is associated with Button object event.
See also
Related concepts
Related procedures
Application examples
References