0

I tried to print output result of my python program to log file using by this command:

./project.py > result.log

And when i opened result.log i found one problem. It missed some tail of output i think it's about 5 - 15 of the last lines

How to solve this problem?

Addtionnal information:

  • Language: Python
  • Termianl: iTerm2
  • OS: OSX
2
  • is there an issue in your program where python code breaks and stops the logging.you check is your code running good Commented Jul 15, 2014 at 6:45
  • I'm sure. It's running well. When i didn't use redirect i got the full output on terminal. but when i used > i missed some tail of information. Commented Jul 15, 2014 at 6:49

2 Answers 2

1

Try running following command

./project.py > result.log 2>&1

It may be possible that missing lines are going for stderr instead of stdout.

Sign up to request clarification or add additional context in comments.

Comments

1

That's the STDOUT flushing problem. It will buffer your output until some internal buffers are full. Try this to set stdbuf to line buffer mode:

stdbuf -oL ./project.py &> result.log

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.