Re:File Locks on Linux
by Joker_vD on Wednesday May 10, 2023 @02:55AM
(#35884465)
...what's wrong with writing to stderr? If you do that, then whatever is on its reading side can route the logs wherever and however it wants to, without any need for locking/truncating shenanigans. Or is it way too simple?
[ Parent
| on HN ]
Exactly. Nothing at all is wrong with it.
Whereas rotating logs as aforegiven, locked or otherwise, has an unfixable race condition where logs can grow without bounds, because it divorces the log rotater from the log writer. The aforegiven tooling is merely wallpapering over huge cracks and not fixing the actual problems, which were, ironically, fixed with better tooling as long ago as the 1990s.