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?

Him
  • 5,257
  • 3
  • 26
  • 83
  • 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 – sokkyoku Mar 18 '16 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? –  Mar 06 '18 at 15:52

1 Answers1

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.

fuglede
  • 17,388
  • 2
  • 54
  • 99