How do I write debug information inside Hangfire log ?
There are anythings like this ?
public void MyJobCallBack() {
var myJob = Hangfire.JobManager.GetCurrentJob();
myJob.Alert("test"); // or myJob.Debug("test");
}
How do I write debug information inside Hangfire log ?
There are anythings like this ?
public void MyJobCallBack() {
var myJob = Hangfire.JobManager.GetCurrentJob();
myJob.Alert("test"); // or myJob.Debug("test");
}
You need to implement logging using something like NLog - http://docs.hangfire.io/en/latest/users-guide/deployment-to-production/adding-logging.html
getting the current job and jobId from the Hangfire environment would be helpfull. for example to get the jobId
Does anyone have anything new to add here?
Is it possible to get hold of some kind of context which identify what job the code currently executes?
It doesn’t really need to be a ‘human readable’ value, like jobId, as long as it’s something unique.
I was first thinking about thread ids, but I guess threads are reused, so it’s not suitable.