Skip to content

[feature request] Add option to log to seperate folder/file #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tracure1337 opened this issue Sep 28, 2024 · 1 comment
Open

[feature request] Add option to log to seperate folder/file #53

tracure1337 opened this issue Sep 28, 2024 · 1 comment

Comments

@tracure1337
Copy link

[feature request] Add option to log to seperate folder/file

This would be very helpful!

@dominicwenig-hmq
Copy link
Contributor

dominicwenig-hmq commented Apr 25, 2025

That's already possible with the configuration in the logback.xml file.

    <appender name="MSG-LOG-EXT" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${hivemq.log.folder}/msg-log-ext.log</file>
        <append>true</append>
        <encoder name="JSON-ENCODER" class="net.logstash.logback.encoder.LogstashEncoder">
            <timeZone>UTC</timeZone>
            <timestampPattern>yyyy-MM-dd'T'HH:mm:ss.SSS'Z'</timestampPattern>
            <fieldNames>
                <timestamp>time</timestamp>
                <logger>[ignore]</logger>
                <version>[ignore]</version>
                <levelValue>[ignore]</levelValue>
                <thread>[ignore]</thread>
            </fieldNames>
        </encoder>

        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- daily rollover -->
            <fileNamePattern>${hivemq.log.folder}/msg-log-ext.%d{yyyy-MM-dd}.log</fileNamePattern>

            <!-- keep 30 days' worth of history -->
            <maxHistory>30</maxHistory>
        </rollingPolicy>
    </appender>

    <logger name="com.hivemq.extensions.log.mqtt" level="INFO" additivity="false">
        <appender-ref ref="MSG-LOG-EXT"/>
    </logger>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants