12 Factor states that applications should log to the console, those console logs should should be unbuffered, and the logs should be redirected to someplace useful (file, database, whatever).
But writing unbuffered data to anywhere is extremely slow.
Does this mean that 12 Factor is inappropriate when an application is doing a lot of logging (for example, due to regulatory requirements)?
3
I believe you misunderstood the recommendations for logging.
The 12 Factor site states
A twelve-factor app never concerns itself with routing or storage of its output stream. It should not attempt to write to or manage logfiles. Instead, each running process writes its event stream, unbuffered, to
stdout
. During local development, the developer will view this stream in the foreground of their terminal to observe the app’s behavior.
Unless you configure your environment otherwise, stdout
will be buffered. Specifically, the runtime environment standard performs line-buffering on stdout
.
What I believe is meant by 12 Factors is that the application should not concern itself with this buffering and particularly not implement additional buffering above what the environment does for you.
1