From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 8FA0D5A0082 for ; Thu, 16 Feb 2023 18:50:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676569835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8XVXY7CQUGA0UQziz1DFpQsLpoZPTwhp2wIQYn6lkdY=; b=guwCIEur0r2SkhKEjeIxDz2o5yUNt4PdfwV1F6PXN9cXG798OhJLgnyOl4272QjHsAHgyE In3WFr6vRfwkIquyrxznZSBZbldZN60VNquzY5WpNZv9yBjuQ2jdj62RyF99xqYnQcwIqU e6fn/onQQddhROy0TSjqsQuGSJMd/g0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-XisG8TIPMxeUWXRyUzYq8A-1; Thu, 16 Feb 2023 12:50:34 -0500 X-MC-Unique: XisG8TIPMxeUWXRyUzYq8A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA1F080280C; Thu, 16 Feb 2023 17:50:33 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2DA540B40C9; Thu, 16 Feb 2023 17:50:33 +0000 (UTC) Date: Thu, 16 Feb 2023 18:50:31 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v4 1/9] log to stderr until process is daemonized, even if a log file is set Message-ID: <20230216185031.7d71029d@elisabeth> In-Reply-To: References: <20230215082437.110151-1-laine@redhat.com> <20230215082437.110151-2-laine@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: J4U7SV5HLCNQHXLMSMLRQ6OGXHUUNJPD X-Message-ID-Hash: J4U7SV5HLCNQHXLMSMLRQ6OGXHUUNJPD X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laine Stump , passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 16 Feb 2023 16:30:53 +1100 David Gibson wrote: > On Wed, Feb 15, 2023 at 03:24:29AM -0500, Laine Stump wrote: > > Once a log file (specified on the commandline) is opened, the logging > > functions will stop sending error logs to stderr, which is annoying if > > passt has been started by another process that wants to collect error > > messages from stderr so it can report why passt failed to start. It > > would be much nicer if passt continued sending all log messages to > > stderr until it daemonizes itself (at which point the process that > > started passt can assume that it was started successfully). > > > > The system log mask is set to LOG_EMERG when the process starts, and > > we're already using that to do "special" logging during the period > > from process start until the log level requested on the commandline is > > processed (setting the log mask to something else). This period > > *almost* matches with "the time before the process is daemonized"; if > > we just delay setting the log mask a tiny bit, then it will match > > exactly, and we can use it to determine if we need to send log > > messages to stderr even when a log file has been specified and opened. > > > > This patch delays the setting of the log mask until immediately before > > the call to __daemon(). It also modifies logfn() slightly, so that it > > will log to stderr any time log mask is LOG_EMERG, even if a log file > > has been opened. > > > > Signed-off-by: Laine Stump > > Reviewed-by: David Gibson Sorry David, I missed to add *all* your Reviewed-by tags on this series. :/ Thanks a lot for reviewing all this. -- Stefano