Setting Event Properties for Hangfire Logging (with NLog)

Tags: #<Tag:0x00007f065d2e9298> #<Tag:0x00007f065d2e91d0>

Hi there Forum,

I am looking for a way to set the event properties from within hangfire when it does the call to log events.

In my NLog.Config file I have something like this:

<parameter layout="${event-properties:item=source}" name="@Source" />

So, when Hangfire logs the events (this all works perfectly, but) the source is empty.

From our code we do this:

LogEventInfo theEvent = new LogEventInfo(LogLevel.Error, logger.Name, msg);
theEvent.Properties[“source”] = source;

I hope that someone here can assist me with this problem. I would really like to have it log “Hangfire” or something similar instead of an empty string for that event property value.

Regards

Any body got any ideas on how to achieve this?