This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes log4j error - Failed to rename xxxx to xxxx-yyyy-mm-dd Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "log4j error - Failed to rename xxxx to xxxx-yyyy-mm-dd" Watch "log4j error - Failed to rename xxxx to xxxx-yyyy-mm-dd" New topic
Author

log4j error - Failed to rename xxxx to xxxx-yyyy-mm-dd

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 314
I have an EAR project and I only use log4j in its Web project (WAR). It works fine in the beginning but somehow it starts giving me error

Failed to rename "mylog" to "mylog--yyyy-mm-dd", i.e. it does not Roll over. I set the frequency as MIN.

The strange thing is it works fine this whole afternoon but now it starts giving me problem. Yesterday it had the same issue. I restarted my PC and the problem was gone this morning, now the problem reappears. I have to say, this is an application deployed on my local PC so there is no high volume issue, also more importantly, I thoroughly checked and found there is NO other project running log4j to write to that same file !

What could be the problem ??

Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 314
I restarted the application server and the problem was gone again. I am sure it will come back again later. This is the same thing that happened since yesterday.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

This is a Windows system where this occurs? If so then unfortunately that's normal behaviour. There's some situation (which one might describe as a bug) where even if you close a file, trying to rename it immediately after that fails because some process (yours) is using it. And log4j does have to rename "x.log" to "x.log-yyyy-mm-dd".

I finally gave up on this kind of rolling appender for Windows servers and went out looking for a different appender implementation which didn't have this problem. I found one too but I don't have the details here.
Raj Ohadi
Ranch Hand

Joined: Jun 30, 2006
Posts: 314
it is on wondows. Do you mean there should not be a problem on unix ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

I think it's a Windows-specific problem, if that's what you mean.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j error - Failed to rename xxxx to xxxx-yyyy-mm-dd
 
Similar Threads
Date Validation
Getting problem in SimpleDateFormate
Strange problem while accessing date type data columns
DATE Problem
Strange problem while using JDBC