diff --git a/AsbCloudApp/Data/BackgroundWorkDto.cs b/AsbCloudApp/Data/BackgroundWorkDto.cs index b2a3d161..9d4f2105 100644 --- a/AsbCloudApp/Data/BackgroundWorkDto.cs +++ b/AsbCloudApp/Data/BackgroundWorkDto.cs @@ -172,7 +172,7 @@ namespace AsbCloudApp.Data if (progress.HasValue) CurrentState.Progress = progress.Value; - Trace.TraceInformation($"{WorkNameForTrace} state: {newState}"); + Trace.TraceInformation($"{WorkNameForTrace} state: {newState} [{100*progress:#}%]"); } /// diff --git a/AsbCloudInfrastructure/Background/BackgroundWorker.cs b/AsbCloudInfrastructure/Background/BackgroundWorker.cs index 0b563ae7..101a8273 100644 --- a/AsbCloudInfrastructure/Background/BackgroundWorker.cs +++ b/AsbCloudInfrastructure/Background/BackgroundWorker.cs @@ -19,7 +19,7 @@ public class BackgroundWorker : BackgroundService public WorkStore WorkStore { get; } = new WorkStore(); public Work? CurrentWork; - public Exception? MainLoopLastException { get; private set; } = null; + public string MainLoopLastException { get; private set; } = string.Empty; public BackgroundWorker(IServiceProvider serviceProvider) { @@ -54,14 +54,13 @@ public class BackgroundWorker : BackgroundService } catch (Exception ex) { - MainLoopLastException = ex; - var mainLoopLastException = $"BackgroundWorker " + + MainLoopLastException = $"BackgroundWorker " + $"MainLoopLastException: \r\n" + $"date: {DateTime.Now:O}\r\n" + $"message: {ex.Message}\r\n" + $"inner: {ex.InnerException?.Message}\r\n" + $"stackTrace: {ex.StackTrace}"; - Trace.TraceError(mainLoopLastException); + Trace.TraceError(MainLoopLastException); } } }