Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision with Microsoft.Extensions.Telemetry #250

Open
bdovaz opened this issue May 19, 2024 · 1 comment
Open

Collision with Microsoft.Extensions.Telemetry #250

bdovaz opened this issue May 19, 2024 · 1 comment

Comments

@bdovaz
Copy link

bdovaz commented May 19, 2024

https://www.nuget.org/packages/Microsoft.Extensions.Telemetry/

This library provides advanced logging and telemetry enrichment capabilities for .NET applications. It allows for detailed and configurable enrichment of log entries, along with enhanced latency monitoring and logging features. It is built for applications needing sophisticated telemetry and logging insights.

This package replaces the ILoggerFactory implementation and causes it to collide with the ILoggerFactory implementation of this repository:

https://github.com/dotnet/extensions/blob/5752f1d4ac15686432a228099386c709c7dacf74/src/Libraries/Microsoft.Extensions.Telemetry/Logging/LoggingEnrichmentExtensions.cs#L37

I would like to be able to use the Telemetry package at the same time as this Serilog package.

The use of Serilog in my case is because of the need to use certain Sinks (example: OpenSearch), that is why I would like to use all the possible functionalities of Microsoft.Extensions.Logging and Microsoft.Extensions.Telemetry without coupling to Serilog more than necessary.

@nblumhardt
Copy link
Member

Hi @bdovaz,

If you just want to use Serilog as a sink, then adding it via your ILoggingBuilder rather than at the host level will do what you need:

builder.Logging.AddSerilog(..)

The downside is that you will now have two logging frameworks in play, with their own filters, minimum levels, etc., but you should be able to work around that reasonably easily.

Hope this helps,
Nick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants