Skip to content

Commit

Permalink
Removed stderr pipe to stdout on pg_ctl process (#896)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
snooc authored and CyberDem0n committed Dec 21, 2018
1 parent f3da6de commit 7bc8d0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion patroni/postmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def start(pgcommand, data_dir, conf, options):
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)
Expand Down

0 comments on commit 7bc8d0a

Please sign in to comment.