Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to redirect windows event log continuously into a file.

psloglist.exe has the -w feature (that listens for new events and outputs to console) so I tried combining it with redirection into a file like so:

psloglist -w > out.txt

It doesn't work. As new events are logged they do not show up in the file.

However, if I remove > out.txt new events do shows up in the console!

share|improve this question
up vote 0 down vote accepted

In general, I do not know how Windows (or this application) handles writing to files - if this were Perl, I would set the output to unbuffered.

A quick minute of Googling confirmed my thoughts.

share|improve this answer
thanks. psloglist outputs each event immediately with the -w switch. There's no buffering that I can see. If anything it's the redirection (>) itself that might be adding the buffering, but that seems strange. If that were true it would have been the same for every command line program in Windows... – Assaf Lavie Mar 15 '10 at 18:14
Yes, the buffering is on writing to the output file, as explained in that link. No, not every command-line program has to exhibit the same buffering behavior. – mfinni Mar 15 '10 at 18:30… Here's an explanation as to why one command-line program may buffer output, and another won't (when redirected to a file). It depends on how they are written. – mfinni Mar 15 '10 at 18:36
4k buffering is indeed what's happening. But the .cmd workaround didn't fix it. Any ideas how to work around this? – Assaf Lavie Mar 16 '10 at 7:14
What actual problem are you trying to solve? – mfinni Mar 16 '10 at 14:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.