views:

6730

answers:

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?

+4  A: 

Set log_statement to all:

Error Reporting and Logging - log_statement

Chad Birch
I edited original post with more info...
Paul
+13  A: 

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.
Jarret Hardie
I edited original post with more info...
Paul
+1  A: 

+1 to above answers. I use following config

log_line_prefix = '%t %c %u ' # time sessionid user
log_statement = 'all'
Shekhar