up vote 7 down vote favorite
3

Hi. Can anyone tell me how to enable logging of all SQL executed by Postgres (8.3)? Thanks!

Edited (more info) I changed these lines :

log_directory = 'pg_log'    				
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_statement = 'all'

And restart postgres service... But no log was created... I´m using Windows Server 2003

Any idea?

link|flag

3 Answers

up vote 11 down vote accepted

In your data/postgresql.conf file, change the log_statement setting to 'all'.


Edit

Looking at your new information, I'd say there may be a few other settings to verify:

  • make sure you have turned on the log_destination variable
  • make sure you turn on the logging_collector
  • also make sure that pg_log actually exists relative to your data directory, and that the postgres user can write to it.
link|flag
1  
I edited original post with more info... – Paul Apr 6 '09 at 16:47
up vote 4 down vote

Set log_statement to all:

Error Reporting and Logging - log_statement

link|flag
I edited original post with more info... – Paul Apr 6 '09 at 16:46
up vote 1 down vote

+1 to above answers. I use following config

log_line_prefix = '%t %c %u ' # time sessionid user
log_statement = 'all'
link|flag

Your Answer

get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.