title: Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"
body: <p><strong>PostgreSQL 9.4.11</strong></p>
  
  <p><strong>Ubuntu 16.04</strong></p>
  
  <p>For learning porpuses I'd like to log all the SQL commands.</p>
  
  <p>What I'm trying is based on this <a href="https://stackoverflow.com/questions/722221/how-to-log-postgresql-queries">How to log PostgreSQL queries?</a></p>
  
  <p>So, I did:</p>
  
  <pre><code>1. #log_directory = 'pg_log' to log_directory = '/home/michael/pg_log'
  2. #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' to log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
  3. #log_statement = 'none' to log_statement = 'all'
  4. #logging_collector = off to logging_collector = on
  5. sudo service postgresql restart
  </code></pre>
  
  <p>Then I do:
  1. sudo su postgres
  2. psql</p>
  
  <p>And get this error:</p>
  
  <pre><code>postgres@hp:/etc/postgresql/9.4/main$ psql
  psql: could not connect to server: No such file or directory
      Is the server running locally and accepting
      connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
  </code></pre>
  
  <p>If I return the postgresql.conf back to the initial statement and restart postgresql, psql runs without any errors.</p>
  
  <p>Could you help me understand why it is like that and how to cope with this problem?</p>