postgres:我看不到查询logging的查询。 日志文件是空的

我正在努力掌握数据库查询优化。 作为第一步,我需要logging所有查询(以及它们的执行时间到日志文件)。 我的configuration文件看起来这样(我相信我已经打开了最重要的东西): https : //gist.github.com/oltarasenko/5f839214828e4cb95d47

日志文件似乎是在服务器重启后创build的(并且具有正常的rw权限)。 但他们只是空的。

-rw------- 1 postgres postgres 0 Jul 19 14:46 postgresql-2014-07-19_144638.log -rw------- 1 postgres postgres 0 Jul 19 14:51 postgresql-2014-07-19_145107.log -rw------- 1 postgres postgres 0 Jul 19 14:58 postgresql-2014-07-19_145622.log -rw------- 1 postgres postgres 0 Jul 19 14:58 postgresql-2014-07-19_145859.log 

我的猜测是日志进入syslog只是因为你的指令:

log_destination = 'syslog'

你应该尝试:

 log_destination = 'stderr' 

这将生成(非空) *.log文件

要么

 log_destination = 'csvlog' 

这将生成(非空) *.csv文件

我会推荐csvlog因为稍后parsing结果分析会更容易。

但是你可以使用所有的组合(昏迷分离):

 log_destination = 'stderr,csvlog,syslog'