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.

...

Open the mqtt-message.log file and confirm that an extension start entry or other INFO entries are visible.

Code Block
INFO - HiveMQ MQTT Message Log Extension: Will try to read config properties from mqttMessageLog.properties
2024-01-20 18:39:57,455 INFO - HiveMQ MQTT Message Log Extension: Properties initialized to: {subscribe-received=true, pubcomp-send=true, unsuback-send=true, topic-regex=, client-regex=, pubcomp-received=true, client-disconnect=true, puback-received=true, connack-send=true, publish-send=true, suback-send=true, unsubscribe-received=true, pubrec-send=true, pubrec-received=true, verbose=false, ping-request-received=true, pubrel-send=true, client-connect=true, publish-received=true, ping-response-send=true, puback-send=true, pubrel-received=true}

...

Filter by label (Content by label)
page
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@d1770c07
showSpacefalse
sortmodified
showSpacetypefalsepage
reversetruetype
labelskb-how-to-article
cqllabel in ( "extension" , "extennsions" ) and type = "page" and space = "~131801395"labelskb-how-to-article