Date: 26-09-06 11:45
Sometimes it is useful to have PostgreSQL log things. Here is what I use in /usr/local/pgsql/data/postgresql.php. I put these entries at the end of the file, where they are easier to find.
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
log_statement = all
client_min_messages = error
log_min_messages = error
redirect_stderr = on
log_destination = 'stderr,syslog'
log_duration = on
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_rotation_age = 86400
stats_command_string = on
log_line_prefix = '%m %d %p '
You will need to create the pg_log directory (the default logging location):
chown pgsql:pgsql /usr/local/pgsql/data/pg_log
The first time you ask PostgreSQL to log, you'll need to restart it.
If you're just making changes to the configuration, log_line_prefix for example, then you had just reload (aka HUP):
Logging can produce large log files, especially if you are logging every SQL statement on a busy database.