public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 common] REST environment: warn helpers: also log messages to syslog
@ 2024-02-09 14:15 Fiona Ebner
  2024-06-12  9:51 ` Fiona Ebner
  2024-11-11 18:41 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Fiona Ebner @ 2024-02-09 14:15 UTC (permalink / raw)
  To: pve-devel

for better visibility. When not in a task, warnings from these helpers
are only logged to STDERR, which is particularly unhelpful in case of
daemons. This is the main motivation behind this change.

For tasks, warnings from these helpers are already more visible on the
UI side, but when looking at the syslog, one can only see the warning
count from the task right now, not the actual messages. This is
another reason in favor of the change.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Changes in v2:
    * Go with the approach suggested by Thomas.

 src/PVE/RESTEnvironment.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 191c6eb..bfde7e6 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -723,6 +723,7 @@ sub log_warn {
 	$rest_env->warn($message);
     } else {
 	chomp($message);
+	syslog('warning', "%s", $message);
 	print STDERR "WARN: $message\n";
     }
 }
@@ -732,6 +733,7 @@ sub warn {
 
     chomp($message);
 
+    syslog('warning', "%s", $message);
     print STDERR "WARN: $message\n";
 
     $self->{warning_count}++;
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-11 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09 14:15 [pve-devel] [PATCH v2 common] REST environment: warn helpers: also log messages to syslog Fiona Ebner
2024-06-12  9:51 ` Fiona Ebner
2024-09-11 11:46   ` Fiona Ebner
2024-11-11 18:41 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal