From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4EHPGCMxNGCpcQAA0tVLHw (envelope-from ) for ; Mon, 22 Feb 2021 22:33:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id WPeHFCMxNGBnPQAAB5/wlQ (envelope-from ) for ; Mon, 22 Feb 2021 22:33:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CA94427C9F for ; Mon, 22 Feb 2021 23:33:06 +0100 (CET) Received: from localhost ([::1]:37820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEJlJ-0006Ez-PX for larch@yhetil.org; Mon, 22 Feb 2021 17:33:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEJkI-0005wJ-Nb for guix-patches@gnu.org; Mon, 22 Feb 2021 17:32:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46313) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lEJkI-00026R-Ev for guix-patches@gnu.org; Mon, 22 Feb 2021 17:32:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lEJkI-0006jx-68 for guix-patches@gnu.org; Mon, 22 Feb 2021 17:32:02 -0500 Subject: bug#45588: [PATCH] services: postgresql: Log from pg_ctl. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Mon, 22 Feb 2021 22:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 45588 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45588-close@debbugs.gnu.org Mail-Followup-To: 45588@debbugs.gnu.org, mail@cbaines.net, mail@cbaines.net Received: via spool by 45588-done@debbugs.gnu.org id=D45588.161403306325839 (code D ref 45588); Mon, 22 Feb 2021 22:32:02 +0000 Received: (at 45588-close) by debbugs.gnu.org; 22 Feb 2021 22:31:03 +0000 Received: from localhost ([127.0.0.1]:57859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEJjK-0006ih-TN for submit@debbugs.gnu.org; Mon, 22 Feb 2021 17:31:03 -0500 Received: from mira.cbaines.net ([212.71.252.8]:44984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEJjJ-0006iH-2s for 45588-close@debbugs.gnu.org; Mon, 22 Feb 2021 17:31:01 -0500 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 01B1A27BC48 for <45588-close@debbugs.gnu.org>; Mon, 22 Feb 2021 22:30:58 +0000 (GMT) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id da75f4bd for <45588-close@debbugs.gnu.org>; Mon, 22 Feb 2021 22:30:58 +0000 (UTC) References: <20210101101015.6524-1-mail@cbaines.net> User-agent: mu4e 1.4.14; emacs 27.1 From: Christopher Baines In-reply-to: <20210101101015.6524-1-mail@cbaines.net> Date: Mon, 22 Feb 2021 22:30:58 +0000 Message-ID: <878s7fn3a5.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.37 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: CA94427C9F X-Spam-Score: -2.37 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3aBoxFa3C0kJ Christopher Baines writes: > pg_ctl will output errors when starting PostgreSQL, for example about errors > in the configuration file. Without getting pg_ctl to log to a file, I'm not > sure how to find those errors. > > * gnu/services/databases.scm (postgresql-activation): Create > /var/log/postgresql. > (postgresql-shepherd-service): Pass --log=/var/log/postgresql/pg_ctl to > pg_ctl. > --- > gnu/services/databases.scm | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm > index d2dc5f0da8..479a3c56f7 100644 > --- a/gnu/services/databases.scm > +++ b/gnu/services/databases.scm > @@ -205,6 +205,10 @@ host all all ::1/128 md5")) > (mkdir-p #$data-directory) > (chown #$data-directory (passwd:uid user) (passwd:gid user)) > > + ;; Create log directory > + (mkdir-p "/var/log/postgresql") > + (chown "/var/log/postgresql" (passwd:uid user) (passwd:gid user)) > + > ;; Drop privileges and init state directory in a new > ;; process. Wait for it to finish before proceeding. > (match (primitive-fork) > @@ -247,6 +251,7 @@ host all all ::1/128 md5")) > (setgid (passwd:gid user)) > (setuid (passwd:uid user)) > (execl pg_ctl pg_ctl "-D" #$data-directory "-o" options > + "--log=/var/log/postgresql/pg_ctl" > mode))))))) > (pid-file (in-vicinity data-directory "postmaster.pid")) > (action (lambda args This conflicts with https://git.savannah.gnu.org/cgit/guix.git/commit/?id=fe4b8823505c3271fc3eacaa93c30a5cec078739