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 555D05A005E for ; Wed, 15 Feb 2023 12:56:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676462182; 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=ZXs8mY0uuyNV/3D3hPi9uZoKSEPudLJmgAt5jhp/Fug=; b=ChS/diU9kPoJNmNPffu/z4PXguz6V++2CZAz13riwqE3gAPhcfMlCMKxcHQXXlrd7JeYAX 3JfLn1P4+XgEvwfnjzv1Veoqz3hQxkfcVnvDfmcTOqTx6iZ17XmN9tDSOeoqFE7Sm6Ulf+ OODyDLF1Pg/9aFgxM6jYFKWZAOrmHPY= 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-475-n4iU_HB0Ozy4KgdpQQ5UtQ-1; Wed, 15 Feb 2023 06:56:13 -0500 X-MC-Unique: n4iU_HB0Ozy4KgdpQQ5UtQ-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 371C91802D42 for ; Wed, 15 Feb 2023 11:56:13 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AF7740B40C9; Wed, 15 Feb 2023 11:56:13 +0000 (UTC) Date: Wed, 15 Feb 2023 12:56:10 +0100 From: Stefano Brivio To: Laine Stump Subject: Re: [PATCH v4 0/9] error logging fixes Message-ID: <20230215125610.0ee3ec49@elisabeth> In-Reply-To: <20230215082437.110151-1-laine@redhat.com> References: <20230215082437.110151-1-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: NFJ2RZ263K4UR2TLNVW2REUFKCN7UG5D X-Message-ID-Hash: NFJ2RZ263K4UR2TLNVW2REUFKCN7UG5D 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: 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 Wed, 15 Feb 2023 03:24:28 -0500 Laine Stump wrote: > There are two topics covered here: > > 1) If a logFile is set, passt's behavior has been to send all error > messages there, and *not* to stderr. This makes it difficult for > another program that is exec'ing passt (and setting it to log to a > file) to report useful error messages when passt fails - everything > after the point that the logfile is opened is sent only to the > logfile. The first patch makes a simple change to the logging > functions that uses the value of the system logmask to decide if it > should force writing messages to stderr even when a logfile has been > specified. > > Change from "v2": I'm using Stefano's suggestion of "abusing" logmask, > rather than adding a static bool to keep track. > > Change from "v3": tweak a commend to Stefano's liking. > > 2) All the rest of the patches eliminate use of the blanket usage() > function when a commandline error is encountered (and add in > specific/details error messages when previously usage() was all that > was logged), and replace calls to err() followed by exit() with a > single call to the new function die(). > > Change from "v2": I changed the name of the "log and exit" function > from "errexit()" to "die()" at the suggestion of Dave Gibson (Stefano > concurred). Although it seems a bit more violent, it does make moot > many/most of Stefano's nits about needing to split lines to eliminate > > 80 characters (I did address all the rest of the things he pointed > out, though) > > NB: Yes, this says it is v3, and the previous version I sent was v2, > and there *was no v1* - this is because I didn't realize that > git-publish is automatically incrementing the version number every > time I run it, and I had done a test-drive sending the patches to my > personal address prior to sending them to the list - *that* was v1. > > Laine Stump (9): > log to stderr until process is daemonized, even if a log file is set > add die() to log an error message and exit with a single call > eliminate most calls to usage() in conf() > make conf_ports() exit immediately after logging error > make conf_pasta_ns() exit immediately after logging error > make conf_ugid() exit immediately after logging error > make conf_netns_opt() exit immediately after logging error > log a detailed error (not usage()) when there are extra non-option > arguments > convert all remaining err() followed by exit() to die() This looks good to me now. I'll wait a bit longer for reviews before applying. -- Stefano