为什么持续时间不写入日志文件?

问题描述 投票:0回答:2

我使用 PostgreSQL 14。 我的 Postgres 配置:

logging_collector = on  
log_min_duration_statement = 400
log_connections = on
log_disconnections = on
log_duration = off
log_line_prefix = '%Q %r %d ' #%Q = query ID %r = remote host and port %d = database name
log_statement = 'all'

我得到日志:

2022-06-24 10:08:36.668 UTC [92] LOG:  statement: 
                    UPDATE ***
                    SET ****
                    WHERE ***

为什么它没有“持续时间”? 我想要日志:

2022-06-24 10:08:36.668 UTC [92] LOG: duration: 5944.540 ms statement: 
                    UPDATE ***
                    SET ****
                    WHERE ***
postgresql
2个回答
2
投票

尝试设置

log_statement = 'none'
,然后所有运行时间超过 0.4 秒的语句及其持续时间都将被记录。


0
投票

它对我有用

log_statement 'none';
log_min_duration_statement '200';

example in logs
"message: "duration: 220.467 ms  statement: SELECT usena...""

log_statement 'mod'
导致大量日志

© www.soinside.com 2019 - 2024. All rights reserved.