[pve-devel] [PATCH v2 common] REST environment: warn helpers: also log messages to syslog

2024-02-09 Thread Fiona Ebner
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 
Suggested-by: Thomas Lamprecht 
Signed-off-by: Fiona Ebner 
---

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



___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



Re: [pve-devel] [PATCH v2 common] REST environment: warn helpers: also log messages to syslog

2024-06-12 Thread Fiona Ebner
Ping

Am 09.02.24 um 15:15 schrieb Fiona Ebner:
> 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 
> Suggested-by: Thomas Lamprecht 
> Signed-off-by: Fiona Ebner 
> ---
> 
> 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}++;


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel