Open bigwhite opened 6 years ago
The author answered in #86: You can't have two processes fiddling with the file at the same time. Lumberjack has to be in charge of the file, because it keeps track of it's size internally. If something else truncates the file or another process writes to it, then it won't work.
When open existing log file, the openExistingOrNew function use OpenFile with O_APPEND flag, but when creating a new log file, openNew use OpenFile without O_APPEND flag. The two behavior are different. Could anybody tell me why ? In my opinion, openNew should use O_APPEND flag as same as openExistingOrNew does.
The file opened with O_APPEND flag will allow multi-thread/multi-process writing if every write is smaller than 4k. We do not need to use mutex to protect the write.