Skip to content

Flush statistic BEFORE log file rollover #23

Description

@klimchuk

I'm using speed4j with logback.

PeriodicalLog myLog = new PeriodicalLog();
myLog.setPeriod(3600);

Every hour stats recorded to nws log file using Logback and every day file rolled over.

<appender name="statLogFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>/stat/nws.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>/stat/nws_%d{yyyyMMdd}.log.gz</fileNamePattern> <maxHistory>30</maxHistory> </rollingPolicy> <encoder> <pattern>%msg%n</pattern> </encoder> </appender>

However looks like last hour of the day always transferred to next day log file and not rolled over in time like this:

Statistics from Wed Dec 11 23:00:00 UTC 2013 to Thu Dec 12 00:00:00 UTC 2013
Tag Avg(ms) Min Max Std Dev
StatusOp_1:failure 104.55 104.13 106.27 52.17

Statistics from Thu Dec 12 00:00:00 UTC 2013 to Thu Dec 12 01:00:00 UTC 2013
Tag Avg(ms) Min Max Std Dev
StatusOp_1:failure 104.82 104.07 140.47 52.36

Statistics from Thu Dec 12 01:00:00 UTC 2013 to Thu Dec 12 02:00:00 UTC 2013
Tag Avg(ms) Min Max Std Dev
StatusOp_1:failure 104.31 104.01 105.01 52.03

Statistics from Thu Dec 12 02:00:00 UTC 2013 to Thu Dec 12 03:00:00 UTC 2013
Tag Avg(ms) Min Max Std Dev
StatusOp_1:failure 104.23 103.94 105.08 52.01

Is there any way to make sure data flushed BEFORE file rolled over?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions