Show logs in Hangfire Dashboard?
Asked Answered
T

1

7

I've configured Log4net with Hangfire and it's logging correctly to the root directory of my project.

Is it possible to show the logs in the Dashboard UI under the specific job that was executed?

Threegaited answered 11/12, 2020 at 19:35 Comment(0)
T
9

Hangfire.Console

This nuget package will allow you to add logs as you process the method. You can also show progress bar via the context. This is an extension to your existing Hangfire implementation. Be sure to add, 'using Hangfire.Console' in code where you are implementing the logs.

When you call the method, you basically provide null for the PerformContext and Hangfire fills it with the correct context when executing it. Based on this context and the Hangfire.Console extension, you can update the job log with Hangfire.Console's WriteLine(string) method.

Ref: Another thread that talks about how to use context.

Tagmeme answered 11/12, 2020 at 20:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.