logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavan Patel <pavanpate...@gmail.com>
Subject log4j-1.2.16 - RollingFileAppender not rotating logs
Date Thu, 29 Aug 2013 17:30:57 GMT

We have a tomcat application running on Windows 2012 and we are facing
issue with log4j not rotating logs (we are using log4j 1.2.16).

I debugged the issue and found out that RollingFileAppender rollOver()
method using File class renameTo() method to rename the file for rotating
the file. And in my case the renameTo() is returning false and because of
that the log file is not rotating. I first checked all the preliminary
conditions such that file with same name already exists, permission to the
directory, and all the things was proper. Also this issue is coming when I
have too many logs coming into application. So I further investigated and
found that Windows has two file handles opened for that file and because of
that renaming is failing.

I am curious to know the way log4j creates RollingFileAppender for multiple
categories, because in our project same RollingFileAppender is used in
multiple categories. So is there a case that for same file multiple
appenders are created by log4j, because in that case there could be a
possibility that multiple file handles gets created for same file.

Or it could be that this is a Windows 2012 specific issue, because may be
Windows is not closing the file handle, as in rollOver()  method before
renaming the file we close the steam on that file.

Please help me.


View raw message