12

I have an application which is based on a Postgres database and I need to be able to examine the requests the application sends of the database.

I want to have Postgres log all of the queries it receives somewhere that I can examine them in order to rebuild some of its functionality in another application.

Can someone recommend a simple way to logging the queries Postgres receives in a Windows operating system?

Thanks, Craig

1 Answer 1

10

Edit your postgresql.conf for PostgreSQL server, and either change log_statement to 'all' or change log_min_duration_statement to 0.

After the change you have to reload PostgreSQL configuration, and the queries will be logged to PostgreSQL log.

Sign up to request clarification or add additional context in comments.

2 Comments

For those of us that are new to Postgres could you expand on how to "reload PostgreSQL configuration" and where to find the log please.
You can realod your pg configuration by executing select pg_reload_conf(); in pgadmin. You can find your pg logs in : C:\Program Files\PostgreSQL\{version}\data\log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.