From: Tommi <t.m...@ep...> - 2004-02-12 21:03:33
|
Hi, I sent a few days ago a path, which flushes the ConsoleAppender after each= =20 message. I need it, because I use std::ios::sync_with_stdio(false). The=20 functionality is now improved in the CVS-version. Like the file-appender=20 immediateFlush is now a option, which defaults to false. But I think it does not make much sense to make it optional and worse -=20 defaulting to false. Standard is to output each single character written to= =20 std::cout or std::cerr with a systemcall ::write. So even outputting "Hello= "=20 results in 5 systemcalls! That is mandatory, because someone might mix=20 iostream-output with stdio-output (printf and friends). If you don't use=20 stdio, you can switch it off with std::ios::sync_with_stdio(false). That=20 improves vastly the performance of std::cout and std::cerr. So in log4cplus the effect is in default configuration (immediateFlush to=20 false): without std::ios::sync_with_stdio(false): each single character triggers a= =20 system-call (very bad, but standard). with std::ios::sync_with_stdio(false): my logmessages are delayed until the= =20 buffer fills. In my application (a web-application-server) I don't see any= =20 messages until I hav logged enough. That is somekind irritating. I log to=20 stdout for good reason: I want to see, what happens. But I don't see it,=20 because output is buffered. When immediateFlus defaults to true (or is not optional at all) the effect = is: without std::ios::sync_with_stdio(false): no change with std::ios::sync_with_stdio(false): each logmessage is immediatly writte= n=20 to stdout in one single systemcall. I don't see any reason to switch immediateFlush off. It just delays=20 logmessages needlessly. Tommi M=E4kitalo |