We have two ways to Set environment variables before running the program.
- XML configuration file: The configuration parameters of Cyclone DDS are defined using an XML file. You can create a custom XML configuration file and specify the location of the configuration file by setting the CYCLONEDDS_URI environment variable.
- Linux: export CYCLONEDDS_URI=file://$HOME/path/to/dds/configuration.xml
- Direct setting of environment variables: You can also directly set the XML configuration to the CYCLONEDDS_URI environment variable without using external files. For example:
- Linux: export CYCLONEDDS_URI="<CycloneDDS><Domain><General><NetworkInterfaceAddress>127.0.0.1</NetworkInterfaceAddress></General></Domain></CycloneDDS>"
After setting the environment variables, you can verify whether the variables have been set correctly by using the echo $CYCLONEDS_URI command. If everything is normal, the terminal will output the XML configuration you have set.
Please note that the environment variables set using the export command are only valid in the current terminal session. If you open a new terminal window, these variables will not be retained. If you want these variables to be available in all new terminal sessions, you need to add these export commands to your~/. bashrc or~/. profile files.
The logging function of Cyclone DDS:
Configure Tracing and Verbosity:
Tracing and Verbosity: Cyclone DDS can generate detailed tracking information, including all traffic and internal activities. You can set different tracking levels, for example:
Reporting and tracing — Eclipse Cyclone DDS, 0.11.0
Using Tracing and Verbosity:
According to the set Verbosity level, Cyclone DDS will generate logs with different levels of detail.
For example,
<Tracing>
<Verbosity> finest</Verbosity>
<OutputFile>
${HOME}/work_space/log/cyclonedds.log.${CYCLONEDDS_PID}
</OutputFile>
<AppendToFile>true</AppendToFile><EnableCategory>fatal,error,config,info</EnableCategory>
</Tracing>
- In Cyclone DDS, you can set Tracing and Verbosity through an XML configuration file. You need to