如何记录 PostgreSQL 查询?

编程入门 行业动态 更新时间:2024-10-25 15:22:41
本文介绍了如何记录 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 查询?

本文发布于:2023-10-19 14:58:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1507866.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:PostgreSQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!