Hi Karl,

In this case, you can/should simply omit the file property. See [1].

HTH,

--
Ceki
65% of statistics are made up on the spot

[1] http://logback.qos.ch/manual/appenders.html#tbrpFileNamePattern

On 08.01.2013 02:23, Karl Pietrzak wrote:
Hello everyone!

I've come across an issue with RollingFileAppender, but I'm not sure if
it's us or logback.

<configuration>

     <timestamp key="currentDate" datePattern="yyyy_MM_dd" />

     <appender name="dataServiceRequestLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<param name="File" value="${the.log.dir}/${currentDate}.WebService.log"/>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${the.log.dir}/%d{yyyy_MM_dd}.WebService.log</FileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
         <encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
         </encoder>
</appender>

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").

Do you guys think that's OK?  The intention is that there's a separate
file for every day:

  * 2013_01_03.WebService.log
  * 2013_01_04.WebService.log
  * 2013_01_05.WebService.log
  * 2013_01_06.WebService.log

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?

Perhaps there's a better way to achieve the desired functionality.  Is
this worth writing a unit test for in RollingFileAppenderTest.java?

Any tips are greatly appreciated, thanks!



_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to