Log Custom Messages To The Job History Page

Tags: #<Tag:0x00007f066bf1ca20> #<Tag:0x00007f066bf1c5c0> #<Tag:0x00007f066bf1c278>

In this topic (Added logging support to Hangfire ) some default log messages are written in to the history page. What I want is to log custom messages like that.

As an example, I’m doing a Fire-and-Forget method invocation like this.

BackgroundJob.Enqueue(() => SendEmail(name));

I want to log(write) custom messages to current job’s history page inside the SendEmail method.

Is there a way to do this?

Have you looked at this project? https://github.com/pieceofsummer/Hangfire.Console

3 Likes