title: Display Postgres server logs output in terminal and record to logs at same time
body: <p>I'm running Postgres 9.1 (Homebrew installation on Mac OSX) and I'd like to monitor my postgres server more closely.</p>
  
  <p>My question relates to logs. I'd like to get the logs displaying in a terminal pane. Here's what the Postgres <a href="http://www.postgresql.org/docs/9.1/interactive/app-pg-ctl.html" rel="noreferrer">docs</a> say about the logs:</p>
  
  <p>"On Unix-like systems, by default, the server's standard output and standard error are sent to pg_ctl's standard output (not standard error). The standard output of pg_ctl should then be redirected to a file or piped to another process such as a log rotating program like rotatelogs; otherwise postgres will write its output to the controlling terminal (from the background) and will not leave the shell's process group. On Windows, by default the server's standard output and standard error are sent to the terminal. These default behaviors can be changed by using -l to append the server's output to a log file. Use of either -l or output redirection is recommended."</p>
  
  <p>So, when I get my postgres server running with the following:</p>
  
  <pre><code>pg_ctl start -D /usr/local/var/postgres
  </code></pre>
  
  <p>The logs display in the terminal window. When I run:</p>
  
  <pre><code>pg_ctl start -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log
  </code></pre>
  
  <p>the logs go to my logfile and don't display in terminal.</p>
  
  <p>In short, it would be great if anyone can tell me what command I use after I've directed logs to the file (with the second command) to make the logs also appear at the command line. It helps when I'm developing (in Django) to watch the SQL statements get executed in real time.</p>