title: Python logging to console window randomly on different machines
body: <p>I have a Python script that utilizes the logging module to log messages to a file. And in most cases it works just fine, but on some of my co-worker's machines it is logging every message from every imported module to the console window. There doesn't seem to be any pattern as to why this is working on some machines and not on others.</p>
  
  <p>Here is how I set up the logger</p>
  
  <pre><code>logger = logging.getLogger(__name__)
  if __name__ == "__main__":
      args = parser.parse_args()
  
      logging.basicConfig(handlers=[logging.NullHandler()]) #do this so that imported modules don't screw with logging
      logger.setLevel(logging.DEBUG)
      handler = logging.FileHandler(args.log)
      handler.setLevel(logging.DEBUG)
      formatter = logging.Formatter('[%(asctime)s] %(levelname)s: %(message)s')
      handler.setFormatter(formatter)
      logger.addHandler(handler)
  
      logger.info(str(args))
      main(args)
  </code></pre>
  
  <p>So what's happening is first I set up my logger as a global variable, then I use basicConfig to set the root handler as the NullHandler(), this is so that any imported modules won't log anything to my log file or my console window, and finally I set my logger to log to a log file provided in the program arguments.</p>
  
  <p>This works exactly how I want to on my machine, the log file is only written to when I use my <code>logger</code> object. No log messages are passed to my console window and no log messages from imported modules go to my log file.</p>
  
  <p>However, on a few random machines, every single call to <code>logging</code> or <code>logger</code> goes to the console window. The logs in the log file are ok, they only show the logs I expect them to (the ones called with <code>logger</code>).</p>
  
  <p>For instance, when I do <code>logger.info(str(args))</code>, </p>
  
  <p><code>INFO: Namespace(arg1='Foo', arg2='Bar', arg3='foobar')</code></p>
  
  <p>is outputted to the console window.</p>
  
  <p>I can't think of any reason that this would behave differently on different machines. It is the exact same script, the same version of python, and the same version of logging. Any ideas?</p>