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
.