4 ms·
Logging does not mean I/O. Logging to disk means I/O.
by codemac 13y ago
Logging does not mean I/O.
Logging to disk means I/O.
- jasonzemos 13y agoLogging means a I/O operation in some way or another to observe the message. If it's not the disk, it's a buffered stream with a syscall and all kinds of slow. Any other magic (using another thread to do the slow stuff, etc) risks the log message getting lost during a crash and the whole thing being useless.
- henrik_w 13y agoLosing logs at a crash may not be a big deal. It would still be useful if you don't crash. Also, if you can turn logging/tracing on and off dynamically, the average volume of output can still be quite manageable.
- emn13 13y agoYeah, logging certainly can work fine, it's just yet another source of breakage, so it's not necessarily always good.
- perbu 13y agoYou can log to a shared memory segment. You'll need a mutex on it and a writeev call to log to it. And it will survive an application crash.
- codemac 13y agoHell - log to one shared buffer per cpu/thread, and then avoid the mutex. Apparently when saying logging doesn't require I/O at runtime, you gotta talk it out a lot more before people get it.
- Millennium 13y agoBut the point of logs is to put them in a place where they can be observed. That means I/O pretty much by definition. You might put those logs out to the network, where some dedicated logging machine could handle storing them someplace, but that's still I/O.