Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've got a program written in Python that writes to stderr and stdout. I invoke it using pythonw, that means it runs without a command line.

Does Windows save those log files and if yes, where?

(I know I can redirect them in python or using the command line, but are they stored automatically?)

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Assuming your program is called from a Command Prompt, stderr and stdout are by default directed to the console.

If you want to save them to a file, you must redirect the output.

STDOUT:

c:\path\program.exe >c:\temp\stdout.log

STDERR:

c:\path\program.exe 2>c:\temp\stderr.log

STDOUT and STDERR in different files

c:\path\program.exe >c:\temp\stdout.log 2>c:\temp\stderr.log

STDOUT and STDERR in the same file

c:\path\program.exe >c:\temp\stdout.log 2>&1

If you want to add to an existing log file instead of overwriting the content, use ">>" instead of ">". If the logfile does not exist, it will be create in both cases.

Edit: You edited your question with more details after my initial answer. So the new answer would be: no, they are not stored automatically. You must explicitly redirect the output streams to a file if you want to.

share|improve this answer
    
Your answer is better. +1 –  alex Oct 13 '09 at 8:07
1  
DOS died long ago. "Command Prompt" aka cmd.exe is a native Win32 program. –  grawity Oct 13 '09 at 13:14

Your Answer

 
discard

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.