本文介绍了如何记录 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 目录已经存在于 data 目录中,并且 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 the data directory, and that the postgres user can write to it.
更多推荐
如何记录 PostgreSQL 查询?
发布评论