Ok, did a bit more investigation into this problem: The clue lies in the comment in the source for SizeBasedRollingTest at line 120:
// The File.length() method is not accurate under Windows This is an understatement! The File.length() method on windows appears to be completely dependant on the memory, cpu and io usage when the code runs. Even when flush() is called on the writer, windows buffers the write to disk so long that File.length() returns an invalid size. Uncomment the sout call in isTriggeringEvent method of SizeBasedTriggeringPolicy to see file length when testing for rollover. The bug report at: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4290946 confirms this behaviour and classes it as 'not a bug' as it is OS dependant. So the fix for this should be to remove the three assertTrue's from test 2 (lines 116-118) added by Curt in version 1.10. Wouldn't the asserts in the if !windows section account for the files not existing anyway? The sun bug report also points to the force() method in the 1.4> NIO API to ensure content is written before any metadata is returned. Has anyone put any thought into a RollingFileAppender/SizeBasedTriggeringPolicy implementation which uses this new API? If not I will take a look at assessing the reliability and performance of calling force(). Kind Regards Andy > -----Original Message----- > From: Andy McBride [mailto:[EMAIL PROTECTED] > Sent: 18 April 2005 23:20 > To: Log4J Developers List > Subject: SizeBasedRollingTest failing due to output/sizeBased-test2.1 not > existing > > Hi, > > On a clean checkout of log4j head, the runAll target in tests/build.xml > fails on SizeBasedRollingTest due to output/sizeBased-test2.1 not > existing. > > > Reverting the SizeBasedRollingTest class back to version 1.9 makes the > test > succeed. > > I'm running on ant 1.6.2 and jdk1.4.2 on WinXP. > > Is there something extra I need to do to cause this output file be created > or is the test for its presence incorrect? > > Any help would be gratefully received. > > Regards > > Andy > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
