title: How to subscribe to PROCESS_STATE_RUNNING events for all processes
body: <p>I'm using <a href="http://supervisord.org/events.html" rel="nofollow">Supervisor's events framework</a> to subscribe to events from processes managed by Supervisor.</p>
  
  <p>My event listener, <code>processlistener.py</code>, looks like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>import sys
  
  from supervisor.childutils import listener
  
  def write_stdout(s):
      sys.stdout.write(s)
      sys.stdout.flush()
  
  
  def write_stderr(s):
      sys.stderr.write(s)
      sys.stderr.flush()
  
  
  def main():
      while True:
          headers, body = listener.wait(sys.stdin, sys.stdout)
          body = dict([pair.split(":") for pair in body.split(" ")])
  
          write_stderr("Headers: %r\n" % repr(headers))
          write_stderr("Body: %r\n" % repr(body))
  
          if headers["eventname"] == "PROCESS_STATE_RUNNING":
              write_stderr("Process state running...\n")
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>In my <code>supervisord.conf</code>, I have:</p>
  
  <pre><code>[program:theprogramname]
  command=/bin/cat              ; the program (relative uses PATH, can take args)
  process_name=%(program_name)s_%(process_num)s ; process_name expr (default %(program_name)s)
  numprocs=1                    ; number of processes copies to start (def 1)
  
  [eventlistener:theeventlistenername]
  command=python processlistener.py    ; the program (relative uses PATH, can take args)
  process_name=%(program_name)s_%(process_num)s       ; process_name expr (default %(program_name)s)
  numprocs=1                           ; number of processes copies to start (def 1)
  events=PROCESS_STATE_RUNNING         ; event notif. types to subscribe to (req'd)
  </code></pre>
  
  <p>With this configuration, I am expecting my event listener to be notified whenever a process managed by Supervisor enters the <code>RUNNING</code> state. However, this is not the case. When I kill <code>theprogramname</code> with a <code>SIGINT</code> signal, the process is restarted by Supervisor, but my listener doesn't get notified of this.</p>
  
  <p>Am I missing an extra piece of configuration in order to achieve what I want?</p>