From fb29b183cb060c099414728fe54a12f4619d7680 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 6 Oct 2022 18:08:22 +0200 Subject: [PATCH] Added some more logs for backup handling. --- .../DomainObject/AssetsBulkUpdateCommandMiddleware.cs | 4 ++-- .../Backup/BackupProcessor.cs | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetsBulkUpdateCommandMiddleware.cs b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetsBulkUpdateCommandMiddleware.cs index e83eb54b5..ad0da8828 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetsBulkUpdateCommandMiddleware.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Assets/DomainObject/AssetsBulkUpdateCommandMiddleware.cs @@ -139,7 +139,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.DomainObject } catch (Exception ex) { - log.LogError(ex, "Faield to execute asset bulk job with index {index} of type {type}.", + log.LogError(ex, "Failed to execute asset bulk job with index {index} of type {type}.", task.JobIndex, task.CommandJob.Type); @@ -161,7 +161,7 @@ namespace Squidex.Domain.Apps.Entities.Assets.DomainObject } catch (Exception ex) { - log.LogError(ex, "Faield to execute asset bulk job with index {index} of type {type}.", + log.LogError(ex, "Failed to execute asset bulk job with index {index} of type {type}.", task.JobIndex, task.CommandJob.Type); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs index 42c3810e8..5b6229f51 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs @@ -67,6 +67,9 @@ namespace Squidex.Domain.Apps.Entities.Backup if (state.Value.Jobs.RemoveAll(x => x.Stopped == null) > 0) { + // This should actually never happen, so we log with warning. + log.LogWarning("Removed unfinished backups for app {appId} after start.", appId); + await state.WriteAsync(ct); } } @@ -75,6 +78,8 @@ namespace Squidex.Domain.Apps.Entities.Backup { return scheduler.ScheduleAsync(async _ => { + log.LogInformation("Clearing backups for app {appId}.", appId); + foreach (var backup in state.Value.Jobs) { await backupArchiveStore.DeleteAsync(backup.Id, default); @@ -109,6 +114,8 @@ namespace Squidex.Domain.Apps.Entities.Backup Handlers = backupHandlerFactory.CreateMany() }; + log.LogInformation("Starting new backup with backup id '{backupId}'.", run.Job.Id); + state.Value.Jobs.Insert(0, run.Job); try { @@ -192,7 +199,7 @@ namespace Squidex.Domain.Apps.Entities.Backup { await SetStatusAsync(run, JobStatus.Failed); - log.LogError(ex, "Faield to make backup with backup id '{backupId}'.", run.Job.Id); + log.LogError(ex, "Failed to make backup with backup id '{backupId}'.", run.Job.Id); } } @@ -212,6 +219,8 @@ namespace Squidex.Domain.Apps.Entities.Backup throw new DomainObjectNotFoundException(id.ToString()); } + log.LogInformation("Deleting backup with backup id '{backupId}' for app {appId}.", job.Id, appId); + if (currentRun?.Job == job) { currentRun.Cancel();