HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.43k stars 1.7k forks source link

add infos on failed jobs log #2455

Open lucas-clementei1 opened 1 month ago

lucas-clementei1 commented 1 month ago

Hello :)

I'd like to add some info about the Job name in the failed jobs logs in order to create some alerting : Something like this ⬇️

From :

                         _logger.ErrorException(
                        $"Failed to process the job '{context.BackgroundJob.Id}': an exception occurred.",
                        failedState.Exception);

To :

                        _logger.ErrorException(
                        $"Failed to process the job '{context.BackgroundJob.Job?.Type.Name}' with id '{context.BackgroundJob.Id}': an exception occurred.",
                        failedState.Exception);

Is it possible ? I have a branch already ready in local if you want, but I can't create a PR (I'm pretty new, feel free to tell me if it's not the correct way of asking :) )

Thank you in advance

Closes https://github.com/HangfireIO/Hangfire/issues/2454