How could I gain access to the current job ID / context from anywhere

I would like to configure my logging (nlog) to write the current job ID against all records when code is executed within the scope of a job. It’s also possible that this code could execute without being invoked by hangfire.

Is there any way to access the current job context without having to pass through a parameter into every method call? Maybe the call context?


1 Like