Geeksltd / Olive

Olive framework, for more productive cross platform .NET solutions. It's available under the GPL v3 license. See License.md for more information.
https://geeksltd.github.io/Olive
Other
44 stars 44 forks source link

LogFactory does not include ApplicationInsights logger #301

Closed ElasticCoder closed 3 years ago

ElasticCoder commented 3 years ago

https://github.com/Geeksltd/Olive/blob/3ef929b6f6d97e8f5238bdc5127be17db16b0469/Olive/Logging/Log.cs#L75

The first ever call to Olive.Log.For<T>() caches the LogFactory. Unfortunately, if this is done by framework code before the Web application initialisation has a chance to add ApplicationInsights logging, then all subsequent calls to Olive.Log.For<T>() does not return a Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLogger.

Thus no logs are sent to Application Insights.

This is a potential race condition.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.