Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add infos on failed jobs log #2455

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Hangfire.Core/AutomaticRetryAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down