如何记录PostgreSQL查询? [英] How to log PostgreSQL queries?
本文介绍了如何记录PostgreSQL查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何启用由PostgreSQL 8.3执行的所有SQL的日志记录?
How to enable logging of all SQL executed by PostgreSQL 8.3?
已编辑(更多信息) 我更改了这些行:
log_directory = 'pg_log'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_statement = 'all'
然后重新启动PostgreSQL服务...但是没有创建日志... 我正在使用Windows Server 2003.
And restart PostgreSQL service... but no log was created... I'm using Windows Server 2003.
有什么想法吗?
推荐答案
在您的data/postgresql.conf
文件中,将log_statement
设置更改为'all'
.
In your data/postgresql.conf
file, change the log_statement
setting to 'all'
.
修改
查看您的新信息,我想说可能还有其他设置需要验证:
Looking at your new information, I'd say there may be a few other settings to verify:
- 确保已打开
log_destination
变量 - 确保打开
logging_collector
- 还请确保
log_directory
目录中已经存在log_directory
目录,并且postgres用户可以对其进行写入.
- make sure you have turned on the
log_destination
variable - make sure you turn on the
logging_collector
- also make sure that the
log_directory
directory already exists inside of thedata
directory, and that the postgres user can write to it.
这篇关于如何记录PostgreSQL查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文