Configuring Logging via XML

Logging can also be configured using the DomainParticipantFactory’s LOGGING QosPolicy (DDS Extension) with the tags, <participant_factory_qos><logging>. The fields in the LoggingQosPolicy are described in XML using a 1-to-1 mapping with the equivalent C representation shown below:

struct DDS_LoggingQosPolicy {
	NDDS_Config_LogVerbosity verbosity;
	NDDS_Config_LogCategory category;
	NDDS_Config_LogPrintFormat print_format;   
	char * output_file;
};

The equivalent representation in XML:

<participant_factory_qos>
    <logging>
        <verbosity></verbosity>
        <category></category>
        <print_format></print_format>
	 <output_file></output_file>
    </logging>
</participant_factory_qos>

The attribute <is_default_participant_factory_profile> can be set to true for the <qos_profile> tag to indicate from which profile to use <participant_factory_qos>. If multiple QoS profiles have <is_default_participant_factory_profile> set to true, the last profile with <is_default_participant_factory_profile> set to true will be used.

If none of the profiles have set <is_default_participant_factory_profile> to true, the profile with <is_default_qos> set to true will be used.

In the following example, DefaultProfile2 will be used:

<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:noNamespaceSchemaLocation="../xsd/rti_dds_qos_profiles.xsd">
    <!-- Qos Library -->
    <qos_library name="DefaultLibrary">
        <qos_profile name="DefaultProfile1"
         is_default_participant_factory_profile ="true">
            <participant_factory_qos>
                <logging>
                    <verbosity>ALL</verbosity>
                    <category>ENTITIES</category>
                    <print_format>MAXIMAL</print_format>
                    <output_file>LoggerOutput1.txt</output_file>
                </logging>
            </participant_factory_qos>
        </qos_profile>
        <qos_profile name=
         "DefaultProfile2" 
         is_default_participant_factory_profile ="true">
            <participant_factory_qos>
                <logging>
                    <verbosity>WARNING</verbosity>
                    <category>API</category>
                    <print_format>VERBOSE_TIMESTAMPED</print_format>
                    <output_file>LoggerOutput2.txt</output_file>
                </logging>
            </participant_factory_qos>
        </qos_profile>
        <qos_profile name="DefaultProfile3" is_default_qos="true">
            <participant_factory_qos>
                <logging>
                    <verbosity>ERROR</verbosity>
                    <category>DATABASE</category>
                    <print_format>VERBOSE</print_format>
                    <output_file>LoggerOutput3.txt</output_file>
                </logging>
            </participant_factory_qos>
        </qos_profile>
    </qos_library>
</dds>

Note: The LoggingQosPolicy is currently the only QoS policy that can be configured using the <participant_factory_qos> tag.

© 2018 RTI