title: How do I properly redirect stdout/stderr from a systemd service on Raspbian?
body: <p>I set up a service on Raspbian (Jessie) using systemd to make it start after boot.  The daemon config looks like this:</p>
  
  <pre><code>[Unit]
  After=multi-user.target
  
  [Service]
  Type=idle
  User=root
  ExecStart=/bin/sh -c "exec /home/pi/sources/mydaemon.py &gt;&gt; /home/pi/mydaemon.log 2&gt;&amp;1"
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  
  <p>That redirection <code>&gt;&gt;</code> isn't working.  I have tried most of the options available to the <code>StandardOutput</code> and <code>StandardError</code> but they never end up printing my script's output to /var/log/daemon.log and <code>journalctl -u mydaemon.service</code> only shows messages about the service being started and stopped.</p>
  
  <p>I'm not doing anything funny with file descriptors from within the script currently.  I just want my <code>print()</code> or <code>logging.info()</code> statements to show up somewhere I can read them.  Any ideas?</p>
  
  <p>(Just to be clear, the daemon does have to run as root.  Could that have something to do with my printing problem?)</p>