[logback-user] logback SiftingAppender generated log files cannot be deleted untill stop the tomcat server

mayuran satchithanantham mayuran19 at gmail.com
Sun May 17 10:44:06 CEST 2015

Hi logback geeks,

We are using logback "SiftingAppender" for generating the log files based
on the date and other information such as cycle(Each date can have multiple

Following are the sample logging file names


For the above scenario we are using the following logback configuration.

<appender name="BATCH_LOGGER_APPENDER"
class="ch.qos.logback.classic.sift.SiftingAppender"> <discriminator>
<key>batchLoggerFileName</key> <defaultValue>unknown</defaultValue>
</discriminator> <sift> <appender class="ch.qos.logback.core.FileAppender">
<file>${batchlog.dir}/${batchLoggerFileName}.log</file> <layout
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} | %-5level | [%thread] |
%msg%n%rEx</pattern> </layout> </appender> </sift> </appender> <logger
name="BATCH_LOGGER" level="INFO" additivity="false"> <appender-ref
ref="BATCH_LOGGER_APPENDER"></appender-ref> </logger>

Following is the java code for logging the details to the specific logs

private static final Logger BATCH_LOGGER = LoggerFactory
.getLogger("BATCH_LOGGER"); public void info(JobInfo jobInfo, String
message) { MDC.put("batchLoggerFileName", jobInfo.getJobId());
BATCH_LOGGER.info(message); MDC.remove("batchLoggerFileName"); }

We have some other jobs that do the housekeeping of the old log files with
the retention of 2 days(Two day old files will be moved to another

But even after the job completes, we are not able to move the file. We
suspect that logback is holding the resource and not letting the file to
move or delete.

All the jobs are deployed in a single war file in apache tomcat 8 server.

Can anyone suggest how to enforce logback to release the resource after
logging is completed?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150517/624bf76a/attachment.html>

More information about the Logback-user mailing list