From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 09AC71FF0AE for ; Tue, 13 Oct 2026 08:17:48 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 48B9A205AE; Tue, 13 Oct 2026 08:17:47 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 13 Oct 2026 08:17:42 +0200 Message-Id: Subject: Re: [PATCH proxmox 1/6] log: replace per layer filtering by one global filter From: "Thomas Ellmenreich" To: "Gabriel Goller" X-Mailer: aerc 0.20.0 References: <20261007074527.102419-1-t.ellmenreich@proxmox.com> <20261007074527.102419-2-t.ellmenreich@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791872262590 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.452 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: ZQ2UENT5FVU3YUBMRHSZT5NHMKTHZE3Q X-Message-ID-Hash: ZQ2UENT5FVU3YUBMRHSZT5NHMKTHZE3Q X-MailFrom: t.ellmenreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pdm-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon Oct 12, 2026 at 3:20 PM CEST, Gabriel Goller wrote: >> [snip] >> @@ -153,10 +135,13 @@ impl Logger { >> /// >> /// Also configures the `LogTracer` which will convert all `log` ev= ents to tracing events. >> pub fn init(self) -> Result<(), anyhow::Error> { >> - let registry =3D tracing_subscriber::registry().with(self.layer= ); >> + let registry =3D tracing_subscriber::registry() >> + .with(self.layer) >> + .with(self.global_log_level); >> + >> tracing::subscriber::set_global_default(registry)?; >> =20 >> - LogTracer::init_with_filter(self.global_log_level.as_log())?; >> + LogTracer::init()?; > > Hmm any reason why this was changed? > I'm asking because this means all the log invocations (there aren't many = though) > will build a whole tracing record before being filtered by the level filt= er. > When passing a global log level to the LogTracer, all the levels below wi= ll be > optimized away. > > I'm a bit afraid that there is a crate that has a log::debug! statement i= n the > hot-path in a loop somewhere -- that would mean we create a whole tracing= record > and discard it on every debug! :) > > Note sure if this is a big issue though -- we have very few log invocatio= ns > anyway and other crates shouldn't be such a big issue. Thanks for pointing this out! I removed it thinking that it was completely unnecessary, but what you mentioned would indeed be interesting. My main reason for removing it was to avoid duplicate filter addition, but I now realise that tracing_log would not have respected the tracing_subscriber::filter::EnvFilter so easily. I will check what the best approach here could be and then post the next version. Again, thanks for pointing this out ;) > >> Ok(()) >> } >> } >> --=20