Skip to content

Logger

Controller Logbook

Each controller can hold an unlimited number of controller logs. A controller logbook consists of references to selected local and public variables of the controller.

Global Logbook

The global logbook is a collection of instances of controller logbooks. A controller logbook can be contained in several global logbooks.

Functions

logEntry()

Within a controller, a log entry can be executed with the e function and with the transfer of a controller logbook.

A log entry enters the following variable values into the log system:

  • Current variable values of the controller logbook to which the function is applied.
  • Variable values of the last task run of all other variables contained in the same global logbook.

Log%20Eintrag

logFinalize()

The logFinalize function is used to complete all logfiles for which the corresponding controller logbook is involved.

FileClient Konfiguration

The FileClient configuration defines the way how login information is stored in log files. The FileClient parameters are described in the article FileClient.

As a result of the configuration, a configuration file is created which, together with the software, reaches the control.

Native logger

Logger is also available without Controller Logbook. Use loggerMethods add() to create a new log entry.

native-log-entry

Log type

With native log.add() method following log types are available.

LogType : ModelType MQTT log type name MQTT log type value
error System alarm 1 System alarm supports generic message logging required for platform framework (Exception handling). It is not part of AVM message handler.
It is allowed to use system messaging at application for exceptions like NullPointer, DivisionByZero, .... Keep in mind, that system messages could be forwarded to Service Ui Messages
warning System warning 2 System warning for generic message logging.
info System info 3 System info for generic message logging.
statelog State log 4 Use state log carefully. Since data required for state animation.
Published separately at log/state topic.
data Data 6 Use data for specific log entries from application.

Use Cases

Use Case 1: Cyclical logging of a variable

Create the logbook

Create a controller logbook in the controller definition:

image2017-5-22%2017%2059%2046

Selecting the variables to be logged:

image2017-5-22%2018%200%2056

In a code snippet, call the logEntry function with the controller logbook as a parameter:

image2017-5-23%208%2042%2026

Create a 'global' logbook in the Config:

image2017-5-22%2018%207%2025

Select the previously created controller logbook in the desired controller instance:

image2017-5-22%2018%209%2039

At the point where the model inconsistency is displayed, set a configuration object:

image2017-5-23%207%2032%2037

The logbook is now ready to log entries. These entries are also visible in the Weblog client.

Configure Fileclient

In order to save the log entries to a file with the previously created logbook, a file client must be created and connected to the corresponding logbook. To do this, a new 'loggerUsage' of type 'LogbookStorage' must be created:

image2017-5-23%207%2039%208

Select the desired global logbook:

image2017-5-23%208%204%2035

In the newly created fileclient object, the default values can be used, only the template for the display within the logfile has to be set.

image2017-5-23%208%207%2044

With the open template the representation can be freely defined. In addition to the variables that are contained in the logbook, there are also various types available for determining the date and time:

image2017-5-23%208%2015%2021

The newly created file client must be assigned to any desired hardware config:

image2017-5-23%208%2022%2027

The resulting logfile:

image2017-5-23%208%2050%2027

Use Case 2: Log variables from different controllers

The previously created global logbook can be attached to any other controller logbook:

image2017-5-23%208%2055%2010

With each call to the logEntry () function on one of the attached controller logs, a complete log entry is made for all log elements.

The variables from the newly added logbooks are also available again in the template configuration:

image2017-5-23%208%2057%2042

The resulting logfile:

image2017-5-23%209%201%2039