주요 콘텐츠

Configure Run-Time Logging for AUTOSAR Adaptive Executables

R2026b

As 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:

  1. Create an AUTOSAR architecture model and add the adaptive software component model as a referenced component.

  2. In the architecture model toolstrip, on the Modeling tab, in the Platform section, select Adaptive Platform.

  3. In the Share section of the Modeling tab, select the network binding: DDS or SOME/IP.

  4. In the architecture canvas, click the component block (the model reference block representing the adaptive software component).

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

  6. Build the component model. The build generates C++ code, ARXML files, and the ExecutionManifest.json file 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.

  1. In the architecture model, select the component block.

  2. In the Property Inspector, in the Deployment section, set Log Mode to Console.

  3. Optionally, set the Application ID to a custom identifier for the application.

  4. Build the component model to generate the ExecutionManifest.json file.

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

  1. In the architecture model, select the component block.

  2. In the Property Inspector, in the Deployment section, set Log Mode to File.

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

  4. Optionally, set the Application ID to a custom identifier for the application.

  5. Build the component model to generate the ExecutionManifest.json file.

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

  1. In the architecture model, select the component block.

  2. In the Property Inspector, in the Deployment section, set Log Mode to Network.

  3. Optionally, set the Application ID to a custom identifier for the application.

  4. Build the component model to generate the ExecutionManifest.json file.

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

  6. 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");

See Also

Topics