[logback-user] About MaxHitory

okadam okada.masanao at intra-mart.jp
Tue Mar 9 13:27:04 CET 2010


Hello,

I have a question about MaxHistory.

Logback version is 0.9.18

I think that behavior of MaxHistory is wrong in some circumstances.
The similar behavior exists in the other thread, but I seemed to have not
been resolved.
e.g.)
・technical question
・urgent explination issue

Also, it is not registered in JIRA.
I test following cases. Could you confirm it?
And could you tell me that its performance is normal?

First, I set following xml files.
・<FileNamePattern>logFile.%d{yyyy-MM-dd-HH-mm}.log</FileNamePattern>
・<MaxHistory>2</MaxHistory>

Second, I start the application in the following order.
However, there is no log file in the log Directory.

1. I start the application at [2010-03-09 10:00]
In the log Directory,
・logFile.log
...OK

2. I restart the application at [2010-03-09 10:01]
In the log Directory,
・logFile.log
・logFile.2010-03-09-10-00.log
...OK

3. I restart the application at [2010-03-09 10:02]
In the log Directory,
・logFile.log
・logFile.2010-03-09-10-00.log
・logFile.2010-03-09-10-01.log
...OK

4. I restart the application at [2010-03-09 10:03]
In the log Directory,
・logFile.log
・logFile.2010-03-09-10-01.log
・logFile.2010-03-09-10-02.log
...OK

5. I restart the application at [2010-03-09 10:05]
In the log Directory,
・logFile.log
・logFile.2010-03-09-10-01.log
・logFile.2010-03-09-10-03.log
...NG (logFile.2010-03-09-10-01.log is not deleted.)

6. I restart the application at [2010-03-09 10:08]
In the log Directory,
・logFile.log
・logFile.2010-03-09-10-01.log
・logFile.2010-03-09-10-03.log
・logFile.2010-03-09-10-05.log
...NG (logFile.2010-03-09-10-01.log is not deleted.)


Here is my XML file:

<configuration>
  
  <appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>logFile.log</File>
    <rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <FileNamePattern>logFile.%d{yyyy-MM-dd-HH-mm}.log</FileNamePattern>
      <!-- keep 2 min worth of history -->
      <MaxHistory>2</MaxHistory>
    </rollingPolicy>
    <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>[%-5level][%d{yyyy-MM-dd HH:mm:ss}] %class - %msg%n</Pattern>
    </layout>
  </appender>
  
  <root>
    <level value="debug" />
    <appender-ref ref="FILE"/>
  </root>
  
</configuration>


Regards,
Masanao
-- 
View this message in context: http://old.nabble.com/About-MaxHitory-tp27834946p27834946.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list