[pve-devel] [PATCH manager v3] Fix #482: Add timestamps to backup creation log

Dominic Jäger d.jaeger at proxmox.com
Tue Apr 23 09:04:49 CEST 2019


Adding timestamps to the log messages facilitates troubleshooting.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
v2->v3                                                                          
Adapt to removal of Time::localtime.                                            
Remove $logfd and unnecessary \n                                                
%F instead of %Y-%m-%d

 PVE/VZDump.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 2d2a03cf..6508c833 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -827,7 +827,8 @@ sub exec_backup_task {
 
 	unlink $logfile;
 
-	debugmsg ('info',  "Starting Backup of VM $vmid ($vmtype)", $logfd, 1);
+	debugmsg ('info', "Starting Backup of VM $vmid ($vmtype)", $logfd, 1);
+	debugmsg ('info', "Backup started at " . strftime("%F %H:%M:%S", localtime()));
 
 	$plugin->set_logfd ($logfd);
 
@@ -1043,6 +1044,7 @@ sub exec_backup_task {
 	$task->{state} = 'err';
 	$task->{msg} = $err;
 	debugmsg ('err', "Backup of VM $vmid failed - $err", $logfd, 1);
+	debugmsg ('info', "Failed at " . strftime("%F %H:%M:%S", localtime()));
 
 	eval { $self->run_hook_script ('backup-abort', $task, $logfd); };
 
@@ -1050,6 +1052,7 @@ sub exec_backup_task {
 	$task->{state} = 'ok';
 	my $tstr = format_time ($delay);
 	debugmsg ('info', "Finished Backup of VM $vmid ($tstr)", $logfd, 1);
+	debugmsg ('info', "Backup finished at " . strftime("%F %H:%M:%S", localtime()));
     }
 
     close ($logfd) if $logfd;
-- 
2.11.0




More information about the pve-devel mailing list