From 7bc8d0aac9888d8e797669b1cacb4167a412efa2 Mon Sep 17 00:00:00 2001 From: Cody Coons Date: Fri, 21 Dec 2018 09:41:34 -0500 Subject: [PATCH] Removed stderr pipe to stdout on pg_ctl process (#896) Inheriting stderr from the main Patroni process allows all Postgres logs to be seen along with all patroni logs. This is very useful in a container environment as Patroni and Postgres logs may be consumed using standard tools (docker logs, kubectl, etc). In addition to that, this change fixes a bug with Patroni not being able to catch postmaster pid when postgres writing some warnings into stderr --- patroni/postmaster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patroni/postmaster.py b/patroni/postmaster.py index 99285bd3..0fd068ef 100644 --- a/patroni/postmaster.py +++ b/patroni/postmaster.py @@ -157,7 +157,7 @@ class PostmasterProcess(psutil.Process): cmdline = [pgcommand, '-D', data_dir, '--config-file={}'.format(conf)] + options logger.debug("Starting postgres: %s", " ".join(cmdline)) proc = call_self(['pg_ctl_start'] + cmdline, close_fds=(os.name != 'nt'), - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env) + stdout=subprocess.PIPE, env=env) pid = int(proc.stdout.readline().strip()) proc.wait() logger.info('postmaster pid=%s', pid)