The PLCnext Runtime provides an RSC service, called ITraceControllerService, that a client application written in C++ can use to manage LTTng trace sessions. This example demonstrates the use of the Trace Controller service using an LTTng trace configuration file that is installed on every PLCnext Control device. This example provides an alternative to the manual setup of the same LTTng configuration, described in the following Knowledge Base article:
How to activate the PLCnext Trace Controller (LTTtng)
When started, the LTTng session described in the configuration file creates a snapshot trace when triggered by specific fault conditions on the device.
As with the knowledge base article, this example is not intended to describe how LTTng works, or how to create LTTng configurations, or how to analyse LTTng trace results.
| Description | Value |
|---|---|
| Created | 4.05.2021 |
| Last modified | 05.06.2025 |
| Controller | AXC F 2152 |
| FW | 2025.0 |
| SDK | 2025.0 |
| PLCnext Technology Toolchain | 2025.0 |
A complete description of the Trace Controller service is available from this source:
General information on LTTng is available from the LTTng website.
This example demonstrates features of the Trace Controller RSC service.
It is assumed that the user has some experience building C++ Components and Programs for PLCnext Control.
Prerequisites:
-
AXC F 2152 controller.
-
PLCnext Command Line Interface (CLI) tool, version 2025.0.
-
A Software Development Kit (SDK) for the AXC F 2152 PLCnext Control, version 2025.0.
-
(optional) Eclipse IDE, with the PLCnext Technology add-in installed.
-
(optional) Visual Studio, with the PLCnext Technology extension installed.
Procedure:
-
Clone this repository, e.g.
git clone https://github.com/PLCnext/CppExamples.git -
Create a new ACF project using either the PLCnext Technology CLI tool, or Eclipse, or Visual Studio, with the following settings:
- Project name:
TraceControl - Component name:
TraceControlComponent - Project namespace:
TraceControl
- Project name:
-
Copy the contents of the
Examples/TraceControl/srcdirectory in this repository, to thesrcdirectory of the ACF project. Replace the existing source files with the same name. -
Build the ACF project.
-
Deploy the ACF project to the PLC.
-
Restart the PLCnext Runtime.
-
Check the contents of the file
/opt/plcnext/logs/Custom.log. It should contain messages from your ACF component. In the component source code, you can see where these messages are generated in each step of the call sequence.