poco icon indicating copy to clipboard operation
poco copied to clipboard

Consolidate LogFile implementation to use FileOutputStream

Open matejk opened this issue 1 year ago • 1 comments

LogFile has different implementations for Windows using Win32 API and STD for other platforms where Poco::FileOutputStream is used. Poco::FileOutputStream has Windows and Posix implementations.

LogFile calls FlushFileBuffers on Windows which forcefully flushes buffers to disk. Posix equivalent would be fsync.

  • New function fsync (or flushToDisk) shall be added to FileStream_POSIX and FileStream_WIN32.
  • Implementation of LogFile shall be unified to use FileOutputStream

Related: #2443, #4429.

matejk avatar Jan 31 '24 11:01 matejk

Logically, there should be only LogFile, because we have POSIX and WIN32 FileStream; performance may be the reason for the current state.

Some benchmarking would help to make the right decision, ie. whether it makes sense to introduce LogFile_POSIX, instead of having just one LogFile.

As for flush/sync, those should be two separate properties and they should have strategies with reasonable defaults.

matejk avatar Feb 01 '24 07:02 matejk