logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Reidy <Michael.Re...@S1.com>
Subject RollingFileAppender rollOver() Method Silently Fails
Date Tue, 29 Jul 2003 11:29:45 GMT


Hello All,

not sure if this is the correct forum for this, but anyways.... I was
debugging a problem I had and noticed the following:  2 RollingFileAppenders
open on the same file, caused the removal of all but the current trace file,
I could also explain why this happened but this much more important....I
looked at the code for RollingFileAppender and saw code like this:

Example 1: 

	if (file.exists())
		file.delete();

Example 2:

	LogLog.debug("Renaming file " + file + " to " + target);
	file.renameTo(target);
			

The problem I have with this is that the file.delete() and the
file.renameTo() can fail, but you are not checking if it has.  Both of these
methods return booleans to indicate success or failure.  The least that
could be done is that you log the failure to your own log, otherwise you
could throw and exception or indeed flag it in a return code yourself...


Mike Reidy.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


Mime
View raw message