Python logging with Supervisor
<p>I'm currently using supervisor to monit and daemonize some python scripts easily. However, it seems that supervisor won't log properly. 
The scripts I'm executing is as simple as this :</p>

<pre><code>#!/usr/bin/env python
import pushybullet as pb
import sys, time, logging

# INIT LOGGING
logging.basicConfig(format='%(asctime)s @%(name)s [%(levelname)s]:    %(message)s', level = logging.DEBUG)

if __name__ == '__main__':
    try:
            logging.info('Custom service started')
            while True:
                    #here for the sake of example, actually doing real stuff here
                    time.sleep(2)
    finally:
            logging.info('Custom service stopped')
</code></pre>

<p>And here is the corresponding conf file : </p>

<pre><code>[program:myscript]
directory=/home/pi/Documents/Scripts_py
command=python -u myscript.py
autostart=true
autorestart=true
</code></pre>

<p>So I've tested many things based on many researched on google.
Replacing logging lines by print and then flushing stdout indeeds works; same with -u option to launche the script. But print is not adequate for my needs, Python's logging module is. So I tried to flush after each logging line, and to launch the script in unbuffered mod, but nothing appears! </p>

<p>Thanks in advance for any help! </p>