About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Friday 20 March, 2009

Enable pgsql logging

Some days back I came to situation to find when the table rows are inserted and deleted by an unknown thread!.

Got an idea from one of my colleague and enabled the pgsql logging. It worked great :)

To enable logging

# Edit the pgsql configuration file
/var/lib/pgsql/data/postgresql.conf

# Under section # ERROR REPORTING AND LOGGING
# Edit the logging options and set your preferrence!.


...
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_line_prefix = '%u %h %t'
log_statement = 'all'
log_hostname = on
...


# Go to pgsql logging dir and tail for the logfile.
cd /var/lib/pgsql/data/pg_log/

No comments: