Logging

Introduction

isegHAL contains a logging function to record the data transfer between API, CAN bus, USB and other communication channels. If the isegHAL is running on an iCS system, the logger can be preconfigured in the iCSconfig.xml.

The logging function provides a fine grained control mechanism to specify what is logged for which interface. For example, there could be a full log running on CAN line 0, while API accesses were recorded on CAN line 3 and only errors for all other lines.

To allow this, the items LogLevel and LogPath can be set individually for each line or globally at system level. The system level also configures the logging for non-line errors and events. Example:

iseg_setItem(handle, "LogLevel",   "1");   // Log errors on all lines
iset_setItem(handle, "0.LogLevel", "255"); // Log everything on line 0
iset_setItem(handle, "3.Loglevel,  "12");  // Log API read/write on line 3
Note If the system log level is now written again, all line log levels will be overwritten with the new value.

Within the same log paths, a common log file is written. A new log file will be created if the using one would exceed an upper limit of 10 MB. Maximum 10 logfiles are saved per LogPath, older files are deleted.

Log items

The items LogLevel and LogPath configure the logging function.

Log level bits

The enumeration IsegLogLevel has the following values. These values can be ORed together.

For example, the default value 3 is LogErrors OR LogInformation.

NameValueDescription
LogErrors1Log CAN bus error messages, loss of communication, etc.
LogInformation2Log state of initialising, switch on/off live insertion mode
LogApiRead4Log API read accesses
LogApiWrite8Log API write accesses
LogHvCanReceive32Log CAN receive messages (HV_CANRX)
LogHvCanReadRequest64Log CAN read requests messages (HV_CANRQ)
LogHvCanWriteRequest128Log CAN write request messages (HV_CANTX)
LogLvCanReceive256Log CAN receive messages (LV_CANRX)
LogLvCanReadRequest512Log CAN read request messages (LV_CANRQ)
LogLvCanWriteRequest1024Log CAN write request messages (LV_CANTX)
LogScpiReceive2048Log SCPI receive messages (RX)
LogScpiReadRequest4096Log SCPI read request messages (RQ)
LogScpiWriteRequest8192Log SCPI write request messages (TX)

Log preconfiguration in iCSconfig.xml

The values specified in iCSconfig.xml are loaded at the start of isegHAL. They can be overwritten at runtime with the LogLevel and LogPath items. The iCSconfig.xml can be changed by manual editing or by using iCSconfig > isegHAL.

Note Values that were not set in the configuration file are taken from the next higher node, if available or set to default values.

Example snippet of the isegHAL logger configuration in iCSconfig.xml:

Log file example

Example file /tmp/iseghal_00.log

Note The LOGLEVEL, CANID, DATAID and DATA fields are in hexadecimal.

DATE       TIME          LOGLEVEL   CANID [ DATAID DATA...        ] PACKET NUMBER      EXPECTET ANSWERS
-------------------------------------------------------------------------------------------------------------
2020-04-01 13:02:34.6588 40 CANRQ   0201  [ 6102   00 0F 00 ]       number = 134667736 expected answers = 4
2020-04-01 13:02:34.6599 20 CANRX   0204  [ 6102   00 43 07 CA BD ] number = 474030276 expected answers = 4
2020-04-01 13:02:34.6604 20 CANRX   0204  [ 6102   01 42 F6 00 8D ] number = 474030277 expected answers = 3
2020-04-01 13:02:34.6608 20 CANRX   0204  [ 6102   02 3C 92 9E C0 ] number = 474030278 expected answers = 2
2020-04-01 13:02:34.6613 20 CANRX   0204  [ 6102   03 BD 25 41 A0 ] number = 474030279 expected answers = 1