client_min_messages 是一个控制发送到客户端的消息级别的 配置参数。
client_min_messages 在 PostgreSQL 7.3 中添加。
用法
client_min_messages 可以设置为以下值之一,按消息生成量递增的顺序排列:
ERROR
WARNING
NOTICE
INFO
LOG
DEBUG1
DEBUG2
DEBUG3
DEBUG4
DEBUG5
每个级别都包含其前一个级别的消息,也就是说,不可能只接收特定日志级别的消息。
FATAL 和 PANIC 日志级别不能为 client_min_messages 设置,因为这些消息永远不会发送到客户端。
LOG 级别的消息对于 client_min_messages 来说,“优先级”低于它们在 log_min_messages 中的优先级。文档中没有提及原因,但考虑到 LOG 级别的消息可能非常频繁,将它们排在比更重要的消息低是有意义的。
请注意,无论如何设置,INFO 级别的消息始终会发送到客户端。
默认值
client_min_messages 的默认值为:NOTICE。
按 PostgreSQL 版本详细信息
client_min_messages (PostgreSQL 19)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 18)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 17)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 16)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 15)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 14)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 13)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 12)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 11)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 10)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 9.6)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 9.5)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
| 需要重启 |
false |
文档: client_min_messages
client_min_messages (PostgreSQL 9.4)
| 设置 |
notice |
| 单位 |
|
| 类别 |
客户端连接默认值 / 语句行为 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 9.3)
| 设置 |
notice |
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 9.2)
| 设置 |
notice |
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 9.1)
| 设置 |
notice |
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 9.0)
| 设置 |
notice |
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 8.4)
| 设置 |
notice |
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
enum |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
| 枚举值 |
debug5, debug4, debug3, debug2, debug1, log, notice, warning, error |
| 启动值 |
notice |
| 重置值 |
notice |
| 源文件 |
|
| 源行 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 8.3)
| 设置 |
|
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
有效值为 DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, LOG, NOTICE, WARNING, 和 ERROR。每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
string |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
文档: client_min_messages
client_min_messages (PostgreSQL 8.2)
| 设置 |
|
| 单位 |
|
| 类别 |
报告和日志记录 / 何时记录 |
| 简短描述 |
设置发送到客户端的消息级别。 |
| 扩展描述 |
有效值为 DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, LOG, NOTICE, WARNING, 和 ERROR。每个级别都包含其后的所有级别。级别越靠后,发送的消息越少。 |
| 上下文 |
user |
| 变量类型 |
string |
| 来源 |
默认 |
| 最小值 |
|
| 最大值 |
|
文档: client_min_messages
变更历史
示例
INFO 级别的消息始终发送,即使 client_min_messages 设置为更高级别。
postgres=# SHOW client_min_messages;
client_min_messages
---------------------
notice
(1 row)
postgres=# REINDEX (VERBOSE) TABLE foo;
INFO: index "foo_pkey" was reindexed
DETAIL: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
REINDEX