Can't reduce Hangfire Logging in .Net Core application

Hi All,

I am working on an .Net Core application which utilises Hangfire. I have Version 1.8.18 of AspNetCore, Core, NetCore & SqlServer installed.

I believe I have tried everything mentioned with this forum & other online articles, I cannot reduce the level of logging Hangfire is producing.

I have tried restricting logging in the appsettings, Program.cs (Logging Filters, SqlServerStorage) and various other places, but no luck.

The following is an example of one of the many items being logged, I have noticed that it is SQL jobs creating a lot of the log entries:

2025-03-03 13:04:43 update top (1) JQ
2025-03-03 13:04:43 set FetchedAt = GETUTCDATE()
2025-03-03 13:04:43 output INSERTED.Id, INSERTED.JobId, INSERTED.Queue, INSERTED.FetchedAt
2025-03-03 13:04:43 from [HangFire].JobQueue JQ with (forceseek, readpast, updlock, rowlock)
2025-03-03 13:04:43 where Queue in (queues0) and
2025-03-03 13:04:43 (FetchedAt is null or FetchedAt < DATEADD(second, timeoutSs, GETUTCDATE())); on database host.docker.internal/AppName"
2025-03-03 13:04:43 <134>1 2025-03-03T13:04:43:282Z embdapi embd 7 - [ env=“dev” sev=“info” assemblyName=“AppName” assemblyVersion=“1.0.0.0” threadId=“24” CommandText=“delete JQ from [HangFire].JobQueue JQ with (forceseek, rowlock) where Queue = queue and Id = id and FetchedAt = fetchedAt” DataSource=“host.docker.internal” Database=“AppName” duration=“00:00:00.0049688” appVersion=“1.0.0.0” ] “Finished executing delete JQ from [HangFire].JobQueue JQ with (forceseek, rowlock) where Queue = queue and Id = id and FetchedAt = fetchedAt on database host.docker.internal/AppName”
2025-03-03 13:04:43 <134>1 2025-03-03T13:04:43:283Z embdapi embd 7 - [ env=“dev” sev=“info” assemblyName=“AppName” assemblyVersion=“1.0.0.0” threadId=“24” CommandText="
2025-03-03 13:04:43 set nocount on;set xact_abort on;set tran isolation level read committed;

Has anyone else experienced this and if so, where you able to find a solution?

Thanks,
Chris

1 Like

Can you post the logging configuration in appsettings.json and the code in Program.cs?