Question

I want to log the data (sql requests, in fact) going between my Play and Postgresql 9.2. In MS Server Management Studio there is a "built-in tool" - profile which is very convenient. I use PgAdmin 3 but I didn't find such a tool in it.

Is there any standard one?

Was it helpful?

Solution

In postgresql.conf set log_statement = all, adjust log_line_prefix if you want more details about the client.

You may also want CSV logging so you can easily analyze it - including loading it into a table with COPY. See the documentation for CSV logging.

For more details on log configuration, including things like logging long running statements, see the documentation on log configuration.

You don't have to set these options globally; you can ALTER USER my_play_user SET ... or ALTER DATABASE my_play_database SET ... to make most of them local to a particular user or database.

The Play! framework also has features that enable logging of SQL it sends to PostgreSQL, which may also be handy.

For finer grained profiling/tracing, look at the auto_explain module, pg_stat_statements and pg_stat_plans.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top