Python enable logging for executable during run time
<p>I've created a python module with logging library displaying information. Example of logging output would be...</p>

<pre><code>2016-09-28 02:54:39,089 - INFO - dataServer - Listening for incoming connections...
2016-09-28 02:54:41,089 - INFO - dataServer - Listening for incoming connections...
</code></pre>

<p>I've used pyinstaller to generate an executable from the python module. I was wondering if there was a way to enable the logging to display on command prompt when the executable is executed from the command prompt. I know I log to a file but I want to be able to see the logging information in real time.</p>

<p>You must have added a <em>FileHandler</em> to output the content to a file. Similarly to output the content to console add <em>StreamHandler</em> in this way <strong>sh = logging.StreamHandler(sys.stdout)</strong> and add this handler to logger by <strong>logger.addHandler(sh)</strong></p>

<p>Hope this helps, cheers.</p>

python logging exe pyinstaller