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

  • Every event type has a dedicated table in the database.

  • Each column of the table corresponds to a property of interest of the event type, therefore in each row, that is for each event, the same columns are assigned a value.

A logger for several Types of Events of interest

  • The properties of all the events are recorded in a single database table.

  • The table columns are related to all the properties of interest of all the event types recorded, therefore in each row (that is, for each event), only the columns relating to the reference event type are assigned a value.

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

  1. In Project, right-click Loggers, then click New > Event logger.

  2. Select the events of interest

  3. Select the properties of interest of the events

  4. (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).

  5. 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

  1. To select an event of interest, in the Event logger properties, click image1 next to Event configuration: the event’s set of configuration properties appears.

  2. 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

  3. In the Event type property, select the event type of interest.

    Hint

    for audit event types, it is recommended to create a dedicated logger.

  4. To record only the events generated by user interactions with the application, set Exclude non-interactive sessions to True.

  5. Repeat the previous steps for each event type of interest.

Select the properties of interest of the events

  1. In Project double-click the Event logger object: the list of properties of all the selected event types is displayed in the object editor.

  2. 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

  1. Create a Data grid object and open it in the editor.

  2. 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

DataStore (database)

Event logger

Related procedures

Working with databases

Application examples

Localized Event Logger

Configure a logger for audits

References

Event logger