in reply to Logging and performance

You seem have contradictory requirements. You want it to work with multiple threads. But you also want buffered output. But buffered output means that one thread will write out a block, ending with part of a line, then other threads will write out data before the first thread finishes its line. That will result in corrupted output.

As others have said, try it and see what performance looks like. My bet is that performance will be just fine. After all flushing after a print just means that a block of data is sent to the filesystem. It does not mean that a write happens immediately to disk. Sure, one will happen when the filesystem gets around to it. But pages are generally left dirty in memory for a bit. And as I noted above, the flushes are necessary anyways if you want to be able to avoid having multiple threads cause you headaches.

Replies are listed 'Best First'.
Re^2: Logging and performance
by weismat (Friar) on Feb 19, 2008 at 09:18 UTC
    Unfortunately the performance is not fine. I gave also a wrong number for the data per second - in fact we are talking about up to 100 KByte per second with a base load of maybe 20 KByte/second.
    I guess I will need to move the logging into a seperate thread - so that the application will keep its speed.
      I moved the logging into a seperate thread.
      It was way too slow using the logfile write - I had only about 600.000 lines of constant back log.
      Now I have moved to a standard file and the performance is ok.