I have set up hangfire successfully for my ASP.NET project, i.e. the 11 Hangfire tables are created in my database. I tried the following command inside the Application_Start()
of my project's Global.asax
:
namespace myAPI
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start(
{
System.Diagnostics.Debug.WriteLine("Recurring job will be set up.");
RecurringJob.AddOrUpdate(
"some-id",
() => System.Diagnostics.Debug.WriteLine("Job instance started at " +
DateTime.Now)),
"*/2 * * * 1-5");
}
}
}
Sadly, inside Visual Studio's window Output > Debug I only see Reccuring job will be set up.
and nothing ever after. However, a SELECT * FROM [myContext].[HangFire].[Set]
shows me
Key Score Value ExpireAt
recurring-jobs 1579116240 some-id NULL
So far so good, this means that the job is indeed set up.
But how do I log inside my DB each and each time when the RecurringJob is executed? Do I assume correctly that Hangfire does not do that out of the box and I have to log it myself within the arrow-function? Or is there a more elegant way?
Question on the side: Why don't I see any output of System.Diagnostics.Debug.WriteLine
within my recurring job?