<div dir="ltr"><div style>Hello everyone!</div><div style><br></div><div style>I've come across an issue with RollingFileAppender, but I'm not sure if it's us or logback.</div><br><div><div><configuration></div>
<div><br></div><div> <timestamp key="currentDate" datePattern="yyyy_MM_dd" /></div><div><br></div><div> <appender name="dataServiceRequestLog" class="ch.qos.logback.core.rolling.RollingFileAppender"></div>
<div><span class="" style="white-space:pre"> </span><param name="File" value="${the.log.dir}/${currentDate}.WebService.log"/></div><div><span class="" style="white-space:pre"> </span><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></div>
<div><span class="" style="white-space:pre"> </span><FileNamePattern>${the.log.dir}/%d{yyyy_MM_dd}.WebService.log</FileNamePattern></div><div><span class="" style="white-space:pre"> </span><MaxHistory>30</MaxHistory></div>
<div><span class="" style="white-space:pre"> </span></rollingPolicy></div><div> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"></div><div><span class="" style="white-space:pre"> </span><pattern>%d{HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern></div>
<div> </encoder></div><div><span class="" style="white-space:pre"> </span></appender></div></div><div><br></div><div style>The curious part is that File matches the FileNamePattern for the rolling policy ("${the.log.dir}/${currentDate}.WebService.log" and "${the.log.dir}/%d{yyyy_MM_dd}.WebService.log").</div>
<div style><br></div><div style>Do you guys think that's OK? The intention is that there's a separate file for every day:</div><div style><ul style><li style>2013_01_03.WebService.log</li><li style>2013_01_04.WebService.log<br>
</li><li style>2013_01_05.WebService.log<br></li><li style>2013_01_06.WebService.log<br></li></ul><div style>The issue we're experiencing is seemingly random writes to old log files (e.g., today we saw writes to 2013_01_04.WebService.log). Could this be the rename problem?</div>
<div style><br></div><div style>Perhaps there's a better way to achieve the desired functionality. Is this worth writing a unit test for in RollingFileAppenderTest.java?</div><div style><br></div><div style>Any tips are greatly appreciated, thanks!</div>
</div></div>