diff --git a/src/Hangfire.Core/AutomaticRetryAttribute.cs b/src/Hangfire.Core/AutomaticRetryAttribute.cs index ff57e34b8..04c7dd2ac 100644 --- a/src/Hangfire.Core/AutomaticRetryAttribute.cs +++ b/src/Hangfire.Core/AutomaticRetryAttribute.cs @@ -254,7 +254,7 @@ public void OnStateElection(ElectStateContext context) if (LogEvents) { _logger.ErrorException( - $"Failed to process the job '{context.BackgroundJob.Id}': an exception occurred.", + $"Failed to process the job '{context.BackgroundJob.Job?.Type.Name}' with id '{context.BackgroundJob.Id}': an exception occurred.", failedState.Exception); } } @@ -322,7 +322,7 @@ private void ScheduleAgainLater(ElectStateContext context, int retryAttempt, Fai if (LogEvents) { _logger.WarnException( - $"Failed to process the job '{context.BackgroundJob.Id}': an exception occurred. Retry attempt {retryAttempt} of {Attempts} will be performed in {delay}.", + $"Failed to process the job '{context.BackgroundJob.Job?.Type.Name}' with id '{context.BackgroundJob.Id}': an exception occurred. Retry attempt {retryAttempt} of {Attempts} will be performed in {delay}.", failedState.Exception); } } @@ -344,7 +344,7 @@ private void TransitionToDeleted(ElectStateContext context, FailedState failedSt if (LogEvents) { _logger.WarnException( - $"Failed to process the job '{context.BackgroundJob.Id}': an exception occured. Job was automatically deleted because the retry attempt count exceeded {Attempts}.", + $"Failed to process the job '{context.BackgroundJob.Job?.Type.Name}' with id '{context.BackgroundJob.Id}': an exception occured. Job was automatically deleted because the retry attempt count exceeded {Attempts}.", failedState.Exception); } }