You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Castrianni, Chris {PBSG}" <Ch...@pbsg.com> on 2005/05/06 19:49:42 UTC

FileAppender.ImmediateFlush does not work on CompactFramework

log4net version: 1.2.9-beta
Platform: Windows CE 5.0 / NetCF 1.0


Unfortunately, the FileStream.Flush method in the CompactFramework (used by
the FileAppenders) only flushes the stream to the OS's file buffers (via the
native fflush method). It does not flush the underlying OS's file buffers to
the actual media. You must call the native method:

    bool FlushFileBuffers(IntPtr handle)

to accomplish this. As such, setting ImmediateFlush to 'true' on the
CompactFramework does not accomplish the desired result of immediately
persisting logging events.

Thanks,
Chris

References:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceappdev5/
html/wce50lrffflush.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedata5/ht
ml/wce50lrfflushfilebuffers.asp