This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
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: 316
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: 316
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: 18541
    
    8

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: 316
it is on wondows. Do you mean there should not be a problem on unix ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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