c++loggingpantheios

Concurrent writes to log file with pantheios from multiple processes


Anyone knows if pantheios supports concurrent writing to log file from multiple processes . If I start two instances of my program, then nothing is written to the log file. Should I set some parameter in the library so this can work, or it is just not supported ?


Solution

  • OK this is 3 months ago but still a relevant unanswered question. We had this problem and found that it's documented here for Windows:

    You need to set the PANTHEIOS_BE_FILE_F_SHARE_ON_WINDOWS flag so that the share mode parameter passed to CreateFile() in the be_file_Context::Open() method (pantheios bec.file.cpp) includes FILE_SHARE_WRITE.

    For example, your pantheios_be_file_setFilePath() call could be:

    pantheios_be_file_setFilePath(your_path_name.c_str(),
      PANTHEIOS_BE_FILE_F_SHARE_ON_WINDOWS,
      PANTHEIOS_BE_FILE_F_SHARE_ON_WINDOWS,
      PANTHEIOS_BEID_ALL);