From: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
To: pdm-devel@lists.proxmox.com
Cc: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
Subject: [PATCH datacenter-manager 5/5] api: set REST server debug level based on actual log level
Date: Mon, 21 Sep 2026 11:51:58 +0200 [thread overview]
Message-ID: <20260921095210.229315-7-t.ellmenreich@proxmox.com> (raw)
In-Reply-To: <20260921095210.229315-2-t.ellmenreich@proxmox.com>
Use the configuration returned by the initialised logger to decide whether to
activate debugging for the REST server.
Previously, whether the REST server was in debug mode would only be determined
by the existence of the PROXMOX_DEBUG variable, regardless of its value. Now,
if the environment variable is set to a less verbose level than 'debug', the
REST server will not activate its debug level.
Signed-off-by: Thomas Ellmenreich <t.ellmenreich@proxmox.com>
---
server/src/bin/proxmox-datacenter-api/main.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/server/src/bin/proxmox-datacenter-api/main.rs b/server/src/bin/proxmox-datacenter-api/main.rs
index 57aa6e22..7b2d85cb 100644
--- a/server/src/bin/proxmox-datacenter-api/main.rs
+++ b/server/src/bin/proxmox-datacenter-api/main.rs
@@ -46,13 +46,15 @@ fn main() -> Result<(), Error> {
server::env::sanitize_environment_vars();
- let debug = std::env::var("PROXMOX_DEBUG").is_ok();
-
- proxmox_log::Logger::from_env("PROXMOX_DEBUG", LevelFilter::INFO)
+ let log_config = proxmox_log::Logger::from_env("PROXMOX_DEBUG", LevelFilter::INFO)
.journald_on_no_workertask()
.tasklog_pbs()
.init()?;
+ // NOTE: this will now also activate if a very specific module is set
+ // to debug but the default level is still on info
+ let debug = log_config.global_filter_max_level_hint() >= LevelFilter::DEBUG;
+
if std::env::args().nth(1).is_some() {
bail!("unexpected command line parameters");
}
--
2.47.3
prev parent reply other threads:[~2026-09-21 9:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 9:51 [RFC datacenter-manager/proxmox 0/5] log: allow finegrained control logging levels Thomas Ellmenreich
2026-09-21 9:51 ` [PATCH proxmox 1/5] log: replace per layer filtering by one global filter Thomas Ellmenreich
2026-09-21 9:51 ` [PATCH proxmox 2/5] log: replace simple level filter with env filter Thomas Ellmenreich
2026-09-21 9:51 ` [PATCH proxmox 3/5] log: add tests to the logger Thomas Ellmenreich
2026-09-21 9:51 ` [PATCH proxmox 4/5] log: return the logger configuration after initialisation Thomas Ellmenreich
2026-09-21 9:51 ` Thomas Ellmenreich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260921095210.229315-7-t.ellmenreich@proxmox.com \
--to=t.ellmenreich@proxmox.com \
--cc=pdm-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.