Adding timestamps to the log messages facilitates troubleshooting failing backups. The current version already seems useful to me. A more advanced version with e.g. timezones and weekdays could be produced by additionaly using POSIX strftime or DateTime.
Signed-off-by: Dominic Jäger <d.jae...@proxmox.com> --- PVE/VZDump.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index 7fc69f98..46767277 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -833,7 +833,12 @@ sub exec_backup_task { unlink $logfile; - debugmsg ('info', "Starting Backup of VM $vmid ($vmtype)", $logfd, 1); + + my $start_time = localtime; + my $start_message = sprintf "[%04d-%02d-%02d %02d:%02d:%02d]", + $start_time->year+1900, $start_time->mon+1, $start_time->mday, + $start_time->hour, $start_time->min, $start_time->sec; + debugmsg ('info', "Starting Backup of VM $vmid ($vmtype) $start_message", $logfd, 1); $plugin->set_logfd ($logfd); @@ -1055,7 +1060,11 @@ sub exec_backup_task { } else { $task->{state} = 'ok'; my $tstr = format_time ($delay); - debugmsg ('info', "Finished Backup of VM $vmid ($tstr)", $logfd, 1); + my $end_time = localtime; + my $end_message = sprintf "[%04d-%02d-%02d %02d:%02d:%02d]", + $end_time->year+1900, $end_time->mon+1, $end_time->mday, + $end_time->hour, $end_time->min, $end_time->sec; + debugmsg ('info', "Finished Backup of VM $vmid ($tstr) $end_message", $logfd, 1); } close ($logfd) if $logfd; -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel