/
Overide logback.xml for custom extension
Overide logback.xml for custom extension
This article guides overriding the logback.xml file for a custom extension. The purpose is to generate a separate log file for the custom extension, thereby preventing extension-related log flooding in the hivemq.log
file. It is considered a best practice to maintain a distinct log for custom extensions, as it proves beneficial during the debugging process in cases of unexpected behavior.
Instructions
To create a distinct log file, navigate to and edit the
logback.xml
file located at/opt/hivemq/conf/
. Follow the example below:<appender name="CUSTOM-EXT-LOG-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${hivemq.log.folder}/custom-extension.log</file> <append>true</append> <encoder> <pattern>%~24(%d)~ %msg%n%ex</pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${hivemq.log.folder}/custom-extension-%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>5</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> </appender> <logger name="<--YOUR EXTENSION CLASS NAME-->" level="INFO" additivity="false"> <appender-ref ref="CUSTOM-EXT-LOG-FILE"/> </logger>
Note: Please make sure to use your extension class name for the logger’s name.
Related articles
Related content
Deploy HiveMQ using the HiveMQ Operator in an AKS cluster, and set up a load balancer with a static public IP.
Deploy HiveMQ using the HiveMQ Operator in an AKS cluster, and set up a load balancer with a static public IP.
Read with this
Configuring separate log files for extensions
Configuring separate log files for extensions
More like this
How to change log level at runtime
How to change log level at runtime
More like this
MQTT Message Log Extension Log File Configuration
MQTT Message Log Extension Log File Configuration
More like this
Override the Default logback.xml with the HiveMQ Platform Operator
Override the Default logback.xml with the HiveMQ Platform Operator
More like this
Overriding the logback.xml file in HiveMQ Operator
Overriding the logback.xml file in HiveMQ Operator
More like this