You need to run the query below then restart PostgreSQL to enable logging persistently. *The parameter with ALTER SYSTEM SET
is set to postgresql.auto.conf
rather than postgresql.conf
:
ALTER SYSTEM SET log_statement = 'all';
And, you need to run either of the queries below then restart PostgreSQL to disable logging persistently:
ALTER SYSTEM RESET log_statement;
Or:
ALTER SYSTEM SET log_statement = 'none';
You can also run the query below then need to restart PostgreSQL to enable logging persistently:
ALTER SYSTEM SET log_min_duration_statement = 0;
And, you can also run either of the queries below then need to restart PostgreSQL to disable logging persistently:
ALTER SYSTEM RESET log_min_duration_statement;
Or:
ALTER SYSTEM SET log_min_duration_statement = -1;
Be careful, these queries below cannot enable or disable logging persistently:
SET SESSION log_statement = 'all'
SET log_statement = 'all'
SET LOCAL log_statement = 'all'
SET SESSION log_min_duration_statement = 0;
SET log_min_duration_statement = 0;
SET LOCAL log_min_duration_statement = 0;
Or:
RESET log_statement;
SET SESSION log_statement = 'none'
SET log_statement = 'none'
SET LOCAL log_statement = 'none'
RESET log_min_duration_statement;
SET SESSION log_min_duration_statement = -1;
SET log_min_duration_statement = -1;
SET LOCAL log_min_duration_statement = -1;