OTX-Runtime for DotNet  
Logging and Tracing

With logging and tracing, selected software actions are written to a file with the aim to log the executed actions for later investigations.

Within the OTX tool chain, there are the following independent logging sources. A distinction is made between OTX logging and tool tracing. OTX logging refers to log within OTX with the OTX Logging extension and tool tracing refers to logging within OTX tools such as OTX-Runtime API or OTX-DiagManager API. Furthermore there is a complete tracing of the diagnostic communication.

  1. OTX Logging
    Logging inside OTX test logic
  2. Tool Tracing
    Internal logging of OTX tool chain
  3. DiagLogging
    Logging of detailed diagnostic communication

Other Topics:

  1. Overriding Logging Settings
    Change logging settings without making changes in the application

Default Log-Folders

If the folder for the logging and tracing was not changed the table lists the default log folders.

Logging Type Windows Linux
OTX Logging with OTF "<USER>/AppData/Roaming/OpenTestSystem/<ShortVersion>/Open Test Framework/OTX-Logging" -
OTX Logging with OTX-Runtime API "<USER>/AppData/Roaming/OpenTestSystem/<ShortVersion>/OTX-Runtime API/OTX-Logging" "<TempDir>/OpenTestSystem/<ShortVersion>/OTX-Runtime-API/OTX-Logging"
Tool Tracing "<USER>/AppData/Roaming/OpenTestSystem/<ShortVersion>/OTX-Runtime API/Logging" "<TempDir>/OpenTestSystem/<ShortVersion>/OTX-Runtime-API/Logging"
DiagManager Tracing "<USER>/AppData/Roaming/OpenTestSystem/<ShortVersion>/DiagManager/Logging" "<TempDir>/OpenTestSystem/<ShortVersion>/DiagManager/Logging"
DiagLogging "<USER>/AppData/Roaming/OpenTestSystem/<ShortVersion>/DiagManager/Logging" "<TempDir>/OpenTestSystem/<ShortVersion>/DiagManager/Logging"

OTX Logging

The OTX Logging extension provides functionality which allows for writing log-messages to a logging-resource inside OTX test logic, see WriteLog. This logging is part of the OTX test logic. Two pieces of information are required for logging. The message and the severity level of the log message. The severity can be used to filter which log messages are actually written to the log file.

Note: Log messages are only written to the log file if their SeverityLevel is greater than or equal to the LogLevel.

Note: The settings for the OTX logging are made in the Project settings in the PTX and can be overwritten via the Project settings on the API, see List of all Project Settings.

Note: The logging implementation delivered with the OTX-Runtime API can be replaced by an own implementation, see Custom Implementations.

Note: Each execution creates a new log file.

The implementation of the OTX Logging extension in the OTX-Runtime API supports two types of logging:

  1. Explicit OTX Logging
    Logging via WriteLog as a part of the OTX test logic
  2. Implicit OTX Logging
    Automatic generation of log messages by the OTX-Runtime API

Explicit OTX Logging

Explicit OTX logging is logging via the WriteLog action of OTX. An OTX author can explicitly write a message to the log file anywhere within the OTX test logic via WriteLog.

Implicit OTX Logging

With implicit OTX logging, the OTX-Runtime API automatically generates log messages during OTX execution, see table. The settings for the implicit OTX logging are made in the Project settings in the PTX and can be overwritten via the Project settings on the API. A SeverityLevel can be set for each implicit log message.

Implicit OTX Logging Description Switch ON/OFF (Setting) Severity (Setting)
Communication Trace Writes the request and response PDUs of diagnostic communication into the log file. LogCommunicationTrace LogCommunicationTraceSeverityLevel
Variables Trace Writes each change of each OTX declaration into the log file. LogVariableTrace LogVariableTraceSeverityLevel
OTX Exceptions Writes each OTX exception into the log file. LogOtxException LogOtxExceptionSeverityLevel
OTX IDs Writes the OtxId of each executed activity into the log file. WriteId WriteIdSeverityLevel

OTX Profiling

With the implicit OTX ID logging the following profiling information will be written into the log file:

  • OTX-ID of the to be executed activity
  • Time stamp in nano seconds
  • Thread-ID
  • Used virtual process memory in bytes
  • Used physical process memory in bytes
  • CPU load of process in percent
  • Used virtual system memory in bytes
  • Used physical system memory in bytes
  • CPU load of system in percent

Note: The profiling can be analysed with the OTX Profiler inside the OTX Development Environment.

Tool Tracing

The tool tracing can write each activity of the OTX-Runtime API and the OTX-DiagManager API into a log file.

OTX-Runtime API Tracing

The settings for OTX-Runtime API tracing are made in the RuntimeConfig class, see TraceFolder for the storage directory and OpenTestSystem. Otx.Runtime.Api.RuntimeConfig.TraceLevel "TraceLevel" for message filtering.

Note: A TraceLevel greater Info can have a significant impact on performance and should not be used productively.

Note: For technical reasons, several log files are generated in the same folder depending on the API used, see table below.

Note: Each execution creates a new set of log files.

Log File Description Filename format Settings
OTX Runtime API CPP Writes messages of the CPP OTX Runtime API into the log file. OtxRuntimeApiTrace_CPP_YYYYMMDD_hhmmss.log RuntimeConfig
OTX Runtime API DotNet Writes messages of the DotNet OTX Runtime API into the log file. OtxRuntimeApiTrace_Dotnet_YYYYMMDD_hhmmss.log RuntimeConfig
OTX Runtime API Java Writes messages of the Java OTX Runtime API into the log file. OtxRuntimeApiTrace_Java_YYYYMMDD_hhmmss.log RuntimeConfig
OTX Runtime Runner Writes messages of the OTX Runtime runner into the log file. OtxRunnerTrace_CPP_YYYYMMDD_hhmmss.log RuntimeConfig

DiagManager Tracing

The settings for OTX-DiagManager API tracing are made in the LoggerConfig class, see SetupTracer.

Note: For technical reasons, several log files are generated in the same folder depending on the API used, see table below.

Log File Description Filename format Settings
DiagManager API CPP Writes messages of the CPP DiagManager API into the log file. DiagManagerApi_CPP_YYYY-MM-DD.log LoggerConfig
DiagManager API DotNet Writes messages of the DotNet DiagManager API into the log file. DiagManagerApi_Dotnet_YYYY-MM-DD.log LoggerConfig
DiagManager API Java Writes messages of the Java DiagManager API into the log file. DiagManagerApi_Java_YYYY-MM-DD.log LoggerConfig
DiagManager Runner Writes messages of the DiagManager runner into the log file. OpenTestSystem.OtxDiagManager.Runner_YYYY-MM-DD.log LoggerConfig

DiagLogging

The DiagLogging is part of the OTX-DiagManager API and can create a log file with the complete diagnostic communication which was executed via OTX-DiagManager API. It can contain PDUs, ODX structures and communication parameters, sample see below. The logging must be started via StartDiagLoggging and can be stopped via StopDiagLogging.

Note: Each execution creates a new log file.

Log File Description Filename format Settings
DiagManager DiagLogging Writes diagnostic communication into the log file. "DiagLogging_DiagManager Monitor_YYYYMMDDhhmmss.log" StartDiagLoggging

Sample log file for DiagLogging:

-------------------------------------------------------------------------------------------------------------------------------------
********************************************* Start of Diag-Logging of OTX DiagManager **********************************************
-------------------------------------------------------------------------------------------------------------------------------------
Time of creation | YYYY.MM.DD hh:mm:ss
Test object | DiagManager Monitor
-------------------------------------------------------------------------------------------------------------------------------------
Timestamp ClientName T D Description
|-----^-----|-------^--------|-^-^-|-------------------------------^-------------------------------------------------------------------|
15:48:24:243 Client3 T DiagConfiguration: Project "MyOdxProject"
15:48:29:540 Client3 T DiagConfiguration: Vehicle "CAN"
15:48:33:053 Client3 T IgnitionState = ON
15:48:34:496 Client5 L Tx LL_Gateway
15:48:34:496 Client5 H Tx 22 F1 87
15:48:34:497 Client5 O Tx DiagService_ReadDataByIdentifier
15:48:34:497 Client5 O Tx RQ_DiagService_ReadDataByIdentifier
15:48:34:497 Client5 O Tx SID_RQ - 34 (0x22)
15:48:34:497 Client5 O Tx RecordDataIdentifier - "SparePartNumber"
15:48:34:497 Client0 L LL_Gateway
15:48:34:497 Client0 P ProtocolType = ISO_15765_3_on_ISO_15765_2
15:48:34:498 Client0 P BusType = ISO_11898_2_DWCAN
15:48:34:498 Client0 T StartCommunication
15:48:34:763 Client5 L Rx LL_Gateway
15:48:34:764 Client5 O Rx DiagService_ReadDataByIdentifier
15:48:34:764 Client5 V Rx EV_Gateway_003
15:48:34:764 Client5 H Rx 62 F1 87 30 30 30 30 30 30 30 30 30 30
15:48:34:764 Client5 O Rx PR_DiagService_ReadDataByIdentifier
15:48:34:764 Client5 O Rx Location - BV_Gateway
15:48:34:764 Client5 O Rx SID_PR - 98 (0x62)
15:48:34:764 Client5 O Rx RecordDataIdentifier - "SparePartNumber"
15:48:34:765 Client5 O Rx DataRecord - 1 (0x1)
15:48:34:765 Client5 O Rx SparePartNumber - "0000000000"
15:48:36:047 Client3 T IgnitionState = ON

Overriding Logging Settings

If the OTX runtime is integrated into an application, it can be difficult to change the logging settings without making changes in the application. To avoid this, it is possible to overwrite all logging settings using a configuration file as follows:

  1. Exit the application
  2. Copy the file OtxRuntimeSettings.ini, see Configuration File to the folder where the OTX runtime is located
  3. Change the values ​​in the configuration file
  4. Run the application and create the logging
  5. Delete the configuration file so that the application settings become valid again

Note: All listed properties inside OtxRuntimeSettings.ini can no longer be changed using the API. This means that the API call has no effect on this property.

Note: Properties that are not present in the OtxRuntimeSettings.ini can be set by the application.

Note: The values ​​of the enumerations are the string representation of the related value.

Note: The values ​​of the enumerations and TRUE and FALSE are not case sensitive.

Note: If the DiagManager is in its own folder (different to OTX-Runtime), it uses the OtxRuntimeSettings.ini inside this folder.

Configuration File

The example file lists all settings. The settings are self-explanatory based on their names. The possible values ​​of a setting are derived from their respective settings in the OTX runtime.

OtxRuntimeSettings.ini

[OtxRuntime]
TraceFileMaxCount=3
TraceFileMaxSize=100
TraceFolder=C:\Users\Public\OpenTestSystem\Logging
TraceLevel=INFO
Profiling=True
ProfilingMaxFileSize=100
LoggingDirectory=C:\Users\Public\OpenTestSystem\Logging
LoggingFileSize=2000
LoggingFileName=[Proj]_[Now].log
LoggingMaxFileNumber=3
LoggingHeaderFormat=-------------------------------------------------------------------------------------------------------------------------------------------------\nOpenTestSystem - Logging Extension\n-------------------------------------------------------------------------------------------------------------------------------------------------\nSolution: %[Sol]$s\nStart-Project: %[StartProj]$s\nStart-Document: %[StartDoc]$s\nStart-Package: %[StartPack]$s\nStart-Procedure: %[StartProc]$s\nDate: %[Now]$tD\nUser: %[usr]$s\nComputer: %[Comp]$s\nOTF-Version: %[OTF]$s\nOTX-Version: %[OTX]$s\nRuntimeApi-Version: %[RuntimeApiVersion]$s\nRuntimeApi-Implementation: %[RuntimeApiImplementation]$s\n-------------------------------------------------------------------------------------------------------------------------------------------------\nTime | Document Procedure | Level || Message\n------------ | ------------------------------------------------------------- | ---------- || ----------------------------------------------------
LoggingMessageFormat=%[Now]$8tT.%[Now]$-3tL | %[Doc]$-20s %[Proc]$-40s | %[Lev]$-10s || %[Msg]$s
LoggingLogCommunicationTrace=False
LoggingLogVariableTrace=False
LoggingLogOtxException=False
LoggingLogCommunicationTraceSeverityLevel=TRACE
LoggingLogVariableTraceSeverityLevel=TRACE
LoggingLogOtxExceptionSeverityLevel=TRACE
LoggingWriteId=False
LoggingWriteIdSeverityLevel=ERROR
LoggingLoggingTargetResolving=False
LoggingLoggingLevelDefault=ALL
LoggingLoggingOn=True
[DiagManager]
DiagManagerTraceFileMaxCount=3
DiagManagerTraceFileMaxSize=100
DiagManagerTraceLogLevel=INFO
DiagManagerTraceFolder=C:\Users\Public\OpenTestSystem\Logging
DiagManagerTraceFileName=DiagManagerApi.log
DiagManagerDiagLoggingTestObjectName=DiagManagerApi
DiagManagerDiagLoggingHeaderMap=-------------------------------------------------------------------------------------------------------------------------------------------------\nOpenTestSystem - Logging Extension\n-------------------------------------------------------------------------------------------------------------------------------------------------\nSolution: %[Sol]$s\nStart-Project: %[StartProj]$s\nStart-Document: %[StartDoc]$s\nStart-Package: %[StartPack]$s\nStart-Procedure: %[StartProc]$s\nDate: %[Now]$tD\nUser: %[usr]$s\nComputer: %[Comp]$s\nOTF-Version: %[OTF]$s\nOTX-Version: %[OTX]$s\nRuntimeApi-Version: %[RuntimeApiVersion]$s\nRuntimeApi-Implementation: %[RuntimeApiImplementation]$s\n-------------------------------------------------------------------------------------------------------------------------------------------------\nTime | Document Procedure | Level || Message\n------------ | ------------------------------------------------------------- | ---------- || ----------------------------------------------------
DiagManagerDiagLoggingIsAsync=false
DiagManagerDiagLoggingLogLevel=All
DiagManagerDiagLoggingLogFolder=C:\Users\Public\OpenTestSystem\Logging