[logback-dev] [JIRA] Updates for LOGBACK-1762: SizeAndTimeBasedRollingPolicy not deleting log files at all

logback developers list logback-dev at qos.ch
Wed Aug 16 09:28:00 CEST 2023


logback / LOGBACK-1762 [Open]
SizeAndTimeBasedRollingPolicy not deleting log files at all

==============================

Here's what changed in this issue in the last few minutes.

This issue has been created
This issue is now assigned to you.


View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1762

==============================
 Issue created
------------------------------

Neha Sahni created this issue on 16/Aug/23 9:16

Summary:              SizeAndTimeBasedRollingPolicy not deleting log files at all
Issue Type:           Bug
Affects Versions:     1.2.2, 1.2.8
Assignee:             Logback dev list
Components:           logback-core
Created:              16/Aug/23 9:16
Labels:               SizeAndTimeBasedRollingPolicy archiveRemover
Priority:             Major
Reporter:             Neha Sahni
Description:
  I have tried using logback version 1.2.2 and 1.2.8 with slf4j version of 1.7.21
  
  The log files are not deleting as per the SizeAndTimeBasedRollingPolicy settings
  
  <configuration scan="true" scanPeriod="60 seconds">
  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <file>logs/application.log</file>
  <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
              <fileNamePattern>logs/application_%d\{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
              <maxHistory>14</maxHistory>
              <totalSizeCap>5GB</totalSizeCap>
              <maxFileSize>15MB</maxFileSize>
  </rollingPolicy>
  
   
  
  When I tried to debug TimeBasedArchiveRemover class of logback core, I can see in method cleanPeriod() the files to be deleted are correctly identified and the code tries to delete them but file.delete returns false due to "The process cannot access the file because it is being used by another process." 
  
  And when I checked more on which process can be holding the files, it gives the process Id of my java application itself. Not sure what exactly is holding these files and not letting logback delete them
  
   
  
   


==============================
 This message was sent by Atlassian Jira (v9.6.0#960000-sha1:a3ee8af)



More information about the logback-dev mailing list