11.8. Log profiles

eProsima Fast DDS allows for registering and configuring Log consumers using XML configuration files. Please refer to Logging for more information on Fast DDS extensible Logging built-in module. The logging profiles are defined within the <log> XML tags. The <log> element has two child elements: <use_default> and <consumer>. These are described in the following table.

Name

Description

Values

Default

<use_default>

If set to FALSE, a call to Log::ClearConsumers() is
performed. See Register Consumers.

bool

true

<consumer>

Defines the class and configuration of the consumer to
be registered. Multiple consumers can be registered
this way. See Consumers.

ConsumerDataType

The following constitutes an example of an XML configuration file that sets the Log to use one StdoutConsumer, one StdoutErrConsumer, and one FileConsumer:

<?xml version="1.0" encoding="UTF-8" ?>
<dds xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
    <log>
        <!--
        Clear consumers
        -->
        <use_default>false</use_default>

        <!--
        StdoutConsumer does not have any properties
        -->
        <consumer>
            <class>StdoutConsumer</class>
        </consumer>

        <!--
        StdoutErrConsumer with threshold set to Log::Kind::Error
        -->
        <consumer>
            <class>StdoutErrConsumer</class>
            <property>
                <name>stderr_threshold</name>
                <value>Log::Kind::Error</value>
            </property>
        </consumer>

        <!--
        FileConsumer openning "execution.log" in append mode
        -->
        <consumer>
            <class>FileConsumer</class>
            <property>
                <name>filename</name>
                <value>execution.log</value>
            </property>
            <property>
                <name>append</name>
                <value>true</value>
            </property>
        </consumer>
    </log>
</dds>

11.8.1. ConsumerDataType

Name

Description

Values

<class>

The class of the consumer.

StdoutConsumer

StdoutErrConsumer

FileConsumer

<property>

This element is used to configure the log consumer and only applies
if <class> is set to StdoutErrConsumer or FileConsumer.

PropertyType

11.8.2. PropertyType

Name

Description

Values

Default

<name>

Name of the property to be configured.

filename

append

stderr_threshold

<value>

The value of the property.

  • If <name> is set to filename, then this
    element contains the name of the log file. This
    property only applies if <class> is set to
    FileConsumer

string

output.log

  • If <name> is set to append, then this
    element defines whether the consumer should, upon
    creation, open the file for appending or
    overriding. This property only applies if
    <class> is set to FileConsumer

Boolean

false

  • If <name> is set to stderr_threshold, then
    this element defines the threshold used by the
    Log consumers.
    This property only applies if <class> is set
    to StdoutErrConsumer

Log::Kind

Log::Kind::Warning