Hangfire icon indicating copy to clipboard operation
Hangfire copied to clipboard

AutomaticRetryAttribute & LogProvider

Open barclayadam opened this issue 10 years ago • 1 comments

I've just run in to a small issue that took a little bit of tracking down involving logging. I was trying to set the logging provider through the .UseLogProvider method of GlobalConfiguration to an aggregated logger so I could push errors through to RayGun.

The problem was before calling this method I had referenced the GlobalFilters class which instantiates an instance of AutomaticRetryAttribute. This creates and stores the logger to be used, but is done before I had registered a new logger.

I've worked around the issue by calling LogProvider.SetCurrentLogProvider before doing any other configuration but this could be problematic for anyone doing similar.

Can the use of the logger be changed to be lazy so it's created on first use which should be after all configuration

Also, related, could we have a means of reporting errors that is not just through a logging provider, a centralised way of exception logging / handling to have a slightly more natural integration for this use-case?

Thanks, Adam

barclayadam avatar Mar 21 '16 17:03 barclayadam

see #553 to and alternate way to report exceptions

Elph avatar May 04 '16 14:05 Elph