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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 24 11:20:29 CEST 2019


Am 4/23/19 um 9:04 AM schrieb Dominic Jäger:
> Adding timestamps to the log messages facilitates troubleshooting.

applied, but expanded commit message a bit to make it clear that we
add this only to the task log (not backup log or syslog) as those other
facilities already have date/time prefixed on each message.
Thanks!

> 
> 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;
> 





More information about the pve-devel mailing list