Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
<appender name="MQTT-MESSAGE-LOG-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${hivemq.log.folder}/mqtt-message.log</file>
    <append>true</append>
    <encoder>
        <pattern>%-30(%d %level)- %msg%n%ex</pattern>
    </encoder>
    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
        <fileNamePattern>${hivemq.log.folder}/mqtt-message.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
        <minIndex>1</minIndex>
        <maxIndex>5</maxIndex>
    </rollingPolicy>
    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
        <maxFileSize>100MB</maxFileSize>
        <checkIncrement>10000</checkIncrement>
    </triggeringPolicy>
</appender>

The following example logger configuration adds the required logger.

Example MQTT Message Log extension logger configuration

Code Block
languagexml
<logger name="com.hivemq.extensions.log.mqtt" level="DEBUG" additivity="false">
    <appender-ref ref="MQTT-MESSAGE-LOG-FILE"/>
</logger>
Info

In the logger configuration, the logger name must match the package name of the associated extension and the appender-ref must match the name of the defined appender.

  1. Extension Log File Verification

To verify creation of the extension log file, go to the log folder of your HiveMQ installation. Based on the scanPeriod that is set in the logback.xml file in your conf folder, HiveMQ scans the changes and updates your configuration. If you have disabled automatic scanning (scan=false), you must restart HiveMQ to apply the changes.

...