title: How to Pipe Output to a File When Running as a Systemd Service?
body: <p>I'm having trouble piping the STDOUT &amp; STDERR to a file when running a program as a systemd service. I've tried adding the following to the <code>.service</code> file:</p>
  
  <pre><code>ExecStart=/apppath/appname &gt; /filepath/filename 2&gt;&amp;1
  </code></pre>
  
  <p>But this doesn't work. The output is ending up in /var/log/messages and is viewable using journalctl but I'd like a separate file.</p>
  
  <p>I've also tried setting <code>StdOutput=tty</code> but can't find a way of redirecting this to a file.</p>
  
  <p>Any help would be appreciated.</p>