Open BrightShadow opened 1 year ago
Streamroller works by keeping track of how many bytes it has written to a file (for file rotation by size anyway), so multiple processes writing to the same file will all be trying to rotate it at different times. For date rotation, they will all be trying to rotate the files at the same time. So, in short, I don't think this will work. In general though, never mind if streamroller is involved or not, multiple processes writing to the same file is a bad idea - how will you avoid them trying to write at the same time?
Thanks for information, that's what I thought. I agree this kind of writing to single file from multiple threads isn't a good idea. I was just wondering if you have some multiprocess synchronization / locking etc. Thanks again.
Within a single node.js application, which can have multiple child processes, we do manage the writing of logs with a single process (the individual processes in a node.js cluster delegate the output to the main process). But log4js doesn't attempt to synchronise or lock files, and assumes it is the only process writing to the files.
Hello there. I have a question. Will the streamroller work for e.g. 200 of instances of the same server/process writing to the same logs folder? I mean, will the file rotation and all file data appending work in that case? I have a server which runs in dockerized environment and we can have up to 200 instances of server. I want to use your solution for logging from all instances in parallel, logs should be stored in one place, one file.