<div dir="ltr">Hi,<div><br></div><div>I've been evaluating logback for a project and started playing with a RollingFileAppender. Using 1.1.2</div><div><br></div><div>I was getting some strange behavior, including missing several log events with a very simple test program. I finally tracked it back to the definition of the rotate interval.</div><div><br></div><div>I had this:</div><div><br></div><div><div><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></div><div>   <fileNamePattern>${userid}/${userid}.%d{yyyy-MM-dd-mm}.log</fileNamePattern></div><div>   <maxHistory>30</maxHistory></div><div></rollingPolicy></div></div><div><br></div><div>and was trying to roll over every minute.</div><div><br></div><div>Simple test program:</div><div><br></div><div><div> Logger logger = LoggerFactory.getLogger(LogbackTest.class);</div><div>        MDC.put("userid", "chris");</div><div><br></div><div>        for (int i = 0; i < 30; i++) {</div><div>            logger.debug("Hello World {}", i);</div><div>            try {</div><div>                Thread.sleep(5000);</div><div>            } catch (Exception e) { }</div><div>        }</div></div><div><br></div><div>What I found was the first file created, the minute when the process started, was either missing the first 2-5 log entries or the file was missing.</div><div><br></div><div>If you look closely at the fileNamePattern you'll see I forgot to add the hour to the format. Changing to:</div><div><br></div><div> <fileNamePattern>${userid}/${userid}.%d{yyyy-MM-dd-HH-mm}.log.gz</fileNamePattern><br></div><div><br></div><div>Worked as expected.</div><div><br></div><div>While the mistake was on my side, why would leaving off the hours cause data to be missing? No errors, printing the LoggerContext after it was done running didn't show any errors either.</div><div><br></div><div>I did remove the files between runs, so there was no chance of a file already existing.</div><div><br></div><div>Thanks,</div><div><br></div><div>Chris</div><div><br></div></div>