2

I have a python script with logging that outputs to stdout

logger = logging.getLogger()
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(v_level)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)

It works just fine when I run my script on my linux box, but when I run the script in git-bash on windows, there is no output to the console.

Any thoughts?

2
  • 1
    I've also noticed that git-bash does not print until the process ends, it's really annoying and nobody is talking about it Commented Mar 18, 2016 at 15:20
  • 1
    @sokkyoku I agree that this is annoying, and the python -u solution below does not work for me. maybe some bash magic could solve this? Commented Mar 6, 2018 at 15:52

1 Answer 1

2

Going by the information in this question, it looks like this could well be an issue with output buffering. You can skip buffering by running your script with python -u.

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

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.