Configure Run-Time Logging for AUTOSAR Adaptive Executables
R2026bAs defined in the AUTOSAR Specification of Diagnostic Log and Trace,
adaptive applications can forward event logging information to a console, a file, or
network. This allows you to collate and analyze log data from multiple applications. By
default, the application logs event messages to the local console. To view the log data from
a file or network, you can use third-party tools.
For models using the service interface modeling pattern, select a software component model
and configure run-time logging through the deployment specification in the
Property Inspector of the AUTOSAR architecture model. When you
build the component model from the architecture model, code generation exports the specified
logging properties to the ExecutionManifest.json file. The manifest file
configures aspects of the run-time behavior of the adaptive application Linux® executable, such as the logging mode.
To configure logging properties:
Create an AUTOSAR architecture model and add the adaptive software component model as a referenced component.
In the architecture model toolstrip, on the Modeling tab, in the Platform section, select
Adaptive Platform.In the Share section of the Modeling tab, select the network binding:
DDSorSOME/IP.In the architecture canvas, click the component block (the model reference block representing the adaptive software component).
In the Property Inspector, expand the Deployment section. The following logging properties are available:
Application ID — Specify a value as an identifier for the application. If not specified, the value is autogenerated.
Log Mode — Select the logging destination: Console (default), File, or Network.
Log File Path — Path to the log file. This field appears only when Log Mode is set to File. If not specified, the log file is saved in the executable folder.
Build the component model. The build generates C++ code, ARXML files, and the
ExecutionManifest.jsonfile containing the configured logging properties.
Logging to Console
Console logging is the default mode. Log messages are written to the standard output of the application process.
In the architecture model, select the component block.
In the Property Inspector, in the Deployment section, set Log Mode to Console.
Optionally, set the Application ID to a custom identifier for the application.
Build the component model to generate the
ExecutionManifest.jsonfile.On a Linux system, build and run the executable. Verify that log messages appear on the console.
Logging to File
File logging writes log messages to a file on disk. Use this mode to persist log data for later analysis.
In the architecture model, select the component block.
In the Property Inspector, in the Deployment section, set Log Mode to File.
In the Log File Path field, specify the path to the log file. If you leave this field empty, the log file is saved in the executable folder.
Optionally, set the Application ID to a custom identifier for the application.
Build the component model to generate the
ExecutionManifest.jsonfile.On a Linux system, build and run the executable. Verify that the log file is created at the specified or default location.
Logging to Network
Network logging forwards log messages over the network. Use this mode with third-party log viewers to monitor log data from multiple applications in real time.
In the architecture model, select the component block.
In the Property Inspector, in the Deployment section, set Log Mode to Network.
Optionally, set the Application ID to a custom identifier for the application.
Build the component model to generate the
ExecutionManifest.jsonfile.Initialize the AUTOSAR run-time environment for adaptive applications using the Linux Runtime Manager (Embedded Coder). For more information, see Build Simulink Model and Deploy Application (Embedded Coder).
Start the application using Linux Runtime Manager and see the log messages appear on the log viewer.
Note
To use the ara::log block in models, copy it from the
adaptive_msg_sender model from the Get Started with Embedded Coder Support Package for Service-Oriented Applications on Linux
example.
Open the example model containing ara::log block by using the command:
openExample("adaptive_msg_sender");