Add error logging to JobRunnerHostedService
Previously, only job cancellations were logged. Now, in addition to logging job cancellations, the service will also log errors when a job fails, providing better diagnostics and troubleshooting.
This commit is contained in:
parent
1c9f6648e4
commit
2a31f598a7
|
|
@ -44,6 +44,10 @@ public class JobRunnerHostedService : BackgroundService
|
|||
{
|
||||
_logger.LogInformation("Job {JobId} was canceled", jobItem.JobId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Job {JobId} failed", jobItem.JobId);
|
||||
}
|
||||
finally
|
||||
{
|
||||
jobItem.OnJobCompleted(jobItem.JobId);
|
||||
|
|
|
|||
Loading…
Reference in a new issue