PostgreSQL 9.4.11
Ubuntu 16.04
For learning porpuses I'd like to log all the SQL commands.
What I'm trying is based on this How to log PostgreSQL queries?
So, I did:
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
Then I do: 1. sudo su postgres 2. psql
And get this error:
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"?
If I return the postgresql.conf back to the initial statement and restart postgresql, psql runs without any errors.
Could you help me understand why it is like that and how to cope with this problem?