Improvement: Shared Files
JKamsker opened this issue · comments
When logging from multiple processes into the same file, the file will be corrupted.
To prevent that, the file could be locked during the actual write, and the lock could be released after that.
I am writing something fairly similar to this and archived over 2 million messages/sec with that approach.
Here is my approach if you want to get some inspiration: https://gist.github.com/JKamsker/0de2d65ba0730d89022e7aea83ca7643
Serilog's FileSink has shared(use mutex) and it may be a common option required for loggers.
I will consider introducing it, thanks.
I've released 2.3.0, it includes this feature.