暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Postgres日志

liyuan 2025-04-23
74

This parameter enables the logging collector, which is a background process that captures log messages sent to stderr and redirects them into log files. This approach is often more useful than logging to syslog, since some types of messages might not appear in syslog output. (One common example is dynamic-linker failure messages; another is error messages produced by scripts such as archive_command.) This parameter can only be set at server start.

(此参数启用日志收集器,日志收集器是一个后台进程,它捕获发送到stderr的日志消息并将其重定向到日志文件中。这种方法通常比将日志记录到syslog更有用,因为某些类型的消息可能不会出现在syslog输出中。(一个常见的例子是动态链接器故障消息;另一种是由脚本(如archive_command)产生的错误消息。该参数只能在服务器启动时设置。)

该参数注意事项:

1.It is possible to log to stderr without using the logging collector; the log messages will just go to wherever the server's stderr is directed. However, that method is only suitable for low log volumes, since it provides no convenient way to rotate log files. Also, on some platforms not using the logging collector can result in lost or garbled log output, because multiple processes writing concurrently to the same log file can overwrite each other's output.

(可以在不使用日志收集器的情况下记录到stderr;日志消息将直接发送到服务器的标准错误所指向的任何地方。但是,该方法只适用于低日志卷,因为它不提供旋转日志文件的方便方法。此外,在一些不使用日志收集器的平台上,可能会导致日志输出丢失或乱码,因为并发地写同一日志文件的多个进程可能会覆盖彼此的输出。)

2.The logging collector is designed to never lose messages. This means that in case of extremely high load, server processes could be blocked while trying to send additional log messages when the collector has fallen behind. In contrast, syslog prefers to drop messages if it cannot write them, which means it may fail to log some messages in such cases but it will not block the rest of the system.

(日志收集器被设计为永远不会丢失消息。这意味着,在负载非常高的情况下,当收集器落后时,服务器进程可能会在尝试发送额外的日志消息时被阻塞。相反,如果syslog不能写入消息,则更倾向于丢弃消息,这意味着在这种情况下,它可能无法记录某些消息,但不会阻塞系统的其余部分。)

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论